Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- By Johurt, 2014/10/01
- mktime ( http://wiki.sa-mp.com/wiki/Useful_Functions#mktime ) function analog
- */
- stock GetDateAsTimestamp(yy, mm, dd, hh, mins, secs) // GMT +2 (Vilnius)
- {
- new timestamp, metu_skirtumas = yy - 1970, c, menesio_dienos[12];
- timestamp = (metu_skirtumas * 31536000) + ((dd-1) * 86400) + ((hh-3) * 3600) + (mins * 60) + secs;
- if(mm > 1)
- {
- menesio_dienos = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- for(c = 0; c < mm-1; c++)
- {
- timestamp += (menesio_dienos[c] * 86400);
- }
- }
- for(c = 0; c < metu_skirtumas; c++)
- {
- if((((1970 + c + 1) % 4 == 0) && ((1970 + c + 1) % 100 != 0)) || ((1970 + c + 1) % 400 == 0)) timestamp += 86400;
- }
- return timestamp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement