Jump to content
Sign in to follow this  
XLimas

Different date and time

Recommended Posts

XLimas

Hello,

I'm trying to create GUI which shows few different time zones time.

I have tried different ways, but still have one or another problem.

For example, if you use @HOUR - 2 in GUICtrlCreateLabel, it shows hours as 8, instead of 08. Also, if you subtract more hours than it currently has it won't change day and will show negative hours.

Maybe there is anything like current_time-2 hours? :D

Here is my attempt:

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

GUICreate("Time", 200, 80)
GUISetState()

Do
    $tNew = _Date_Time_EncodeSystemTime(@MON, @MDAY , @YEAR, @HOUR-12, @MIN, @SEC)
    $hour= @HOUR - 12
    GUICtrlCreateLabel("Time is " & _Date_Time_SystemTimeToDateTimeStr($tNew), 10, 10)

    GUICtrlCreateLabel("Time is " & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, 10, 25)
    If $hour<10 Then
        GUICtrlCreateLabel("Time is " & @MON & "/" & @MDAY & " 0" & $hour & ":" & @MIN & ":" & @SEC, 10, 40)
    Else
        GUICtrlCreateLabel("Time is " & @MON & "/" & @MDAY & " " & $hour & ":" & @MIN & ":" & @SEC, 10, 40)
    EndIf
    
    Sleep(1000)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites
KaFu
XLimas

Oh damn, i missed this function in help file.

Thanks for your help.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.