02.06.2012, 14:27
(
Последний раз редактировалось Jochemd; 06.04.2013 в 15:09.
)
TimestampToDate & DateToTimestamp
Hello,
Unix Timestamps for beginners
For those who are not familliar with Unix Timestamps, take a look at Wikipedia (press the link).
Introduction
Today, I'll present one of my new works: TimestampToDate. This library is able to convert your specified timestamp to a date.
- Timezone supported.
- Leap years supported.
- Easy to use
The syntaxes are as followed:
Explanation
pawn Код:
stock TimestampToDate(Timestamp, &year, &month, &day, &hour, &minute, &second, HourGMT, MinuteGMT = 0)
The year, month, day, hour, minute and second parameters should be filled in like you do in getdate and gettime.
Since v2.0, this library contains a new stock: DateToTimestamp. I will explain this as well.
pawn Код:
stock DateToTimestamp(str[11])
Download
v2.0 --> http://pastebin.com/7LQB5Ki1
Example --> http://pastebin.com/HP9F63a2
- Open the link and press RAW.
- Copy all text and save it right here: "server_dir/pawno/includes" under filename: TimestampToDate.inc.
- Add "#include <TimestampToDate>" in the script you'd like to use it (gamemode?).
Do not redistribute this without my permission. Link people to this topic instead of direct download. It will be appreciated!