Jump to content

Timestamp


gosu
 Share

Recommended Posts

This is function I use to time stamp things I work with. A example would be a ticket a user opened for service. I have it tied to a hotsetkey so I can stamp when I need to. When I hit the key, it sends the following example in the ticket system I use:

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

A4MH3: Thursday 06/08/2006, 10:16:56 AM:

The code I use for it is this:
Func _F9A_Func(); TimeStamp
 $sLongDayName = _DateDayOfWeek(@WDAY)
 $stamp = _NowTime()
 $stamp2 = _NowDate()
 if WinActive("Service Request", "equest.nsf") then   ;
  send("---------------------------")
  send("{ENTER}")
 endif 
 sleep(20)
 Send(@UserName & ": " & $sLongDayName & " " & $stamp2 & ", " & $stamp & ": ")
;EndIf
EndFunc  ;==>_F9A_Func
Link to comment
Share on other sites

  • Moderators

I know, I was just hoping that somebody else had already take the time to code one.

Do you at least have a layout step by step of what your trying to achieve?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 3 weeks later...

Rise from the dead, thread!

I am in the need of generating an UNIX timestamp, as my script communicates with a PHP script and I would like to pass a timestamp with all communications.

As mentioned earlier in this thread, a unix timestamp is the number of seconds that has passed since the Unix Epoch (January 1 1970 00:00:00 GMT).

Also mentioned in this thread, this is a good start:

#Include <Date.au3>
$unixtimestamp = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())oÝ÷ Øz0z÷«ØZ±©é®åzh§¶­×hzÉ赧¢éí~íç.®·§¶Ø¦{:'xèºwm+¡×­¢­¶ººÞÛbìèê'juÏÿm4Ò̬µéºÚ"µÍÌÍÞTYÔXY
    ][ÝÒÑVWÓÐÐSÓPPÒSIÌLÔÖTÕSIÌLÐÛÛÛÙ]IÌLÐÛÛÛ ÌLÕ[YVÛR[ÜX][Û][ÝË   ][ÝÔÝ[[YI][ÝÊBÌÍÑÓUTYÔXY
    ][ÝÒÑVWÓÐÐSÓPPÒSIÌLÔÓÑÐTIÌLÓZXÜÜÛÙ   ÌLÕÚ[ÝÜÈ  ÌLÐÝ[Ú[ÛÌLÕ[YHÛÉÌLÉ][ÝÉ[ÉÌÍÞ   ][ÝÑÜ^I][ÝÊBÌÍÑÓUTÝ[ÓZY
    ÌÍÙÛ]
KÊBÙØÞ
K   ][ÝÕ[Y^ÛOI][ÝÉ[ÉÌÍÞ    ][ÝÑÓUI][ÝÉ[ÉÌÍÑÓU    [ÈÜ   [È ÌÍÙÛ]   [É][ÝÈÝY][ÝÊ

Using the $gmt2 variable from this code, I can subtract the number of seconds needed from the $unixtimestamp above to get something that is almost correct. However, the problem now is that this does not account for Daylight Saving Time. So close! For example, right now my clock is -7 hours from GMT. It's normally 8 hours back, but it's 7 right now because of Daylight Saving. But that timezone code above only returns -08 for $gmt2.

Any ideas? That timezone code was from a 2 year old thread, so maybe there is a better way now?

Link to comment
Share on other sites

Maybe your script can calculate whether it is currently DST and add the necessary time?

#)

Unfortunately that is not good enough. Some places to not observe DST. I need to know if the system's clock is being adjusted for DST or not so I can adjust the timestamp appropriately. Really I think there should be some built in functions for getting the full date/time (with timezone information) built in to AutoIt.

Any ideas?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...