Sign in to follow this  
Followers 0
InsectGrain

Comparing 2 or more date/time

7 posts in this topic

Hello,

In my script, i need to compare 2 or more date/times... the newest will be highlighted in the gui...

I have looked through the forum and i have only founded on how to compare 2 files like using "_Date_Time_CompareFileTime".

Please help

Share this post


Link to post
Share on other sites



What format are your date/times in?

There are several conversion options within the Date.au3 UDF, but it depends what your initial format is.

Share this post


Link to post
Share on other sites

; add Date
            $Time = FileGetTime($sLine, 0, 0)
            $Month  =   $Time[1]
            $Day    =   $Time[2]
            $Year   =   $Time[0]
            $Hour   =   $Time[3]
            $Minutes =   $Time[4]
            GUICtrlSetData($List2, " <-----Date modified: " & $Month & "/" & $Day & "/" & $Year & "    at: " & $Hour & ":" & $Minutes, 1)
        EndIf

I'm not sure what you mean by format....

Share this post


Link to post
Share on other sites

Can you not use the macros @Hour, @Min etc...?

$a = @SEC
 Sleep(1000)
 $b = @SEC
 If $b > $a Then MsgBox(0,"","$b is newer")

I don't understand, why would I need the system time?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

When you say the newest, do you mean the most recently created or modified? Sorry I see from your example you mean modified. You can concatonate the array elements like this.

$lastMod = $time[0] & $time[1] & $time[2] & $time[3] & $time[4] & $time[5]

Then the largest nmber will be the most recent. Or you can set the format to 1 which does the same thing.

Edited by czardas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0