Jump to content
Sign in to follow this  

Date and time is not with system format

Recommended Posts

To get the current time stamp, I got the below code.

#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; Under Vista the Windows API "SetSystemTime" may be rejected due to system security
$td = _Date_Time_GetSystemTime()
$td = _Date_Time_SystemTimeToDateTimeStr($td)
$td = StringReplace($td, " ", "_")
$td = StringReplace($td, ":", "_")

But it is not giving the date or time of the timezone where the system is there.

Please suggestt

Share this post

Link to post
Share on other sites
2 minutes ago, jguinch said:
ConsoleWrite(@MON & "/" & @MDAY & "/" & @YEAR & "_" & @HOUR & "_" & @MIN & "_" & @SEC)


THanks @jguinch

But in the meanwhile I have replaced my code with the below one.

Func TodayDateTime()
    $td = _DateTimeFormat(_NowCalc(), 0)
    $td = StringReplace($td, " ", "_")
    $td = StringReplace($td, ":", "-")
    return $td


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jahar
      Hi All,
      Please help me on how to fetch date/time of last windows 10 system restore point using autoit? Basically its about querying the last restore point.
    • By TheDcoder
      Hi everyone,
      I am bit stumped as to why I am not able to set the time in the Date control
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm:ss" GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ; Set time Local $iRet = GUICtrlSetData($idDate, '13:33:37') ConsoleWrite('GUICtrlSetData returned ' & ($iRet = 1 ? 'success' : 'failure') & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example The documentation for GUICtrlSetData clearly mentions that it uses the same format as GUICtrlRead:
      But I get failure
      What gives?
      Thanks for the help in advance!
    • By Colduction
      Hi guys, i want to convert WebKit/Chrome timestamps that i've found in chrome cookie database to Human-Readable time (if possible, with UTC or GMT offset).
      Example of WebKit/Chrome timestamp: 13228999534132232 Output that i want: 2020-03-18 20:16:56 This site has a tool to do this work, but i wonder how to convert this time (this timestamp's time bases are 1600/01/01) to human-readable time:
  • Create New...