Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Solved] Doubts with FormatTime..



  • Please log in to reply
3 replies to this topic
Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
Hi
and sorry for doing this stupid Doubt..


I have the following Script that creates a files called Data.txt with his names and LastAccedTime of the files and folders
Loop, %A_Mydocuments%\*.*, 1, 0 ; 1 = FILES AND FOLDERS, 0 = DOnt Recurse into subfolders.
{
FileAppend, %A_LoopFileTimeAccessed% %A_LoopFileName%`n, DATA.txt
}
And for example this tell me:

20120503014901 Amnesia
20120726035041 AutoHotkey
20120725165508 AutoHotkey.ahk

Then.. How I do for Correct That FormatTime and Use the Following Format: " MM-dd-yyyy hh:mm:ss tt "

Always when I tried to use the FormatTime command, I put something that isnt correct -> And I get the ACTUAL-TIME of my computer, and not that LastTimeAccessed.


Thks

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
Here's a quick hardcoded solution:
[color=#0000FF]Time[/color] := "20120726035041"
Year := SubStr([color=#0000FF]Time[/color],1,4)
Month := SubStr([color=#0000FF]Time[/color],5,2)
Day := SubStr([color=#0000FF]Time[/color],7,2)
Hour := SubStr([color=#0000FF]Time[/color],9,2)
Min := SubStr([color=#0000FF]Time[/color],11,2)
Sec := SubStr([color=#0000FF]Time[/color],13,2)
Listvars
Pause
ExitApp

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio Fran├ža -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
✓  Best Answer
...

{

FormatTime, formatted_TimeAccessed , %A_LoopFileTimeAccessed%, MM-dd-yyyy hh:mm:ss tt

FileAppend, %Formatted_TimeAccessed%, DATA.txt

}


Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012

...
{
FormatTime, formatted_TimeAccessed , %A_LoopFileTimeAccessed%, MM-dd-yyyy hh:mm:ss tt
FileAppend, %Formatted_TimeAccessed%, DATA.txt
}


Thank U Very much!!! =D
solved!