14.12.2018, 01:47
TimeStamp to date and vice versa is a very annoying process, but luckily someone has done it for you.
https://sampforum.blast.hk/showthread.php?tid=347605
Although like ****** stated, you can never be 100% accurate with timezones in most situations, so don't expect this to be right every time.
Timestamps are calculated from a certain time at UTC, so you have to account for the player's or server's timezone when you use execute this function, which from personal experience, any work involving timezones should be avoided or an alternative should be found if possible.
https://sampforum.blast.hk/showthread.php?tid=347605
Although like ****** stated, you can never be 100% accurate with timezones in most situations, so don't expect this to be right every time.
Quote:
Originally Posted by ******
I didn't say it was impossible, just hard. Some things you've missed:
Daylight Savings - Even England isn't in GMT at the moment Awkward Countries - Some of Austraila is +9.5 or +10.5 depending on season, other parts are + other numbers all year (one tiny part is +8.45). Some areas are +5.45, +12.45, +13, +14! Date - Timezones can make the day different in different areas. Changes - Russia abolished daylight savings just last year, and the day it starts changes regularly in other countries. Leap Years - I'm not entirely convinced looking at the code that you've got them right (in fact I know you don't because leap years are not that simple). Leap Seconds - They exist! Calendar - What about Jews? It's the year 5772 for them. There is a central website (can't remember where) that maintains a list of all these things, Linux and Mac both sync of this one resource, Microsoft have their own to maintain a list of date information. |