SA-MP Forums Archive
[Include] Timestamp.inc - Time & date unit conversions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Timestamp.inc - Time & date unit conversions (/showthread.php?tid=663394)



Timestamp.inc - Time & date unit conversions - Gammix - 30.01.2019

Timestamp.inc

A simple time conversion library, wasn't documented but was there in my github for some time. You are able to convert timestamps to date and vise versa.
Supports time zones (GMT) and leap year.

Functions:
Download:

https://github.com/Agneese-Saini/SA-.../timestamp.inc


Re: Timestamp.inc - Time & date unit conversions - Calisthenics - 30.01.2019

ParseTimestamp is faulty.
pawn Код:
new timestamp,
    year, month, day, hour, minute, second, hourGMT, minuteGMT;
       
timestamp = gettime();
ParseTimestamp(timestamp, year, month, day, hour, minute, second, hourGMT, minuteGMT);
   
printf("timestamp: %d\n\
        ParseTimestamp: %d/%02d/%02d %02d:%02d:%02d (GMT %02d:%02d)"
,
        timestamp,
        year, month, day, hour, minute, second, hourGMT, minuteGMT);
Results:
Код:
timestamp: 1548841074
ParseTimestamp: 2019/01/05 09:37:54 (GMT 00:00)
Timestamp 1548841074 is Wednesday, January 30, 2019 9:37:54 AM (GMT) in human date.


Re: Timestamp.inc - Time & date unit conversions - Logic_ - 30.01.2019

Use Chrono.