Using this code with my account’s creation date ISO T14:30:45.17Z also gives back 4003 (with decimals that can be cut off with a math function, preferably floor).We do our best to ensure Roblox is a safe and fun place for everyone. For example, my AccountAge property is 4003. Local accountAgeDays = (currentTime - createdTime)/86400įor reference, you can compare the result of your math/DateTime arithmetics with your own account age. Local currentTime = DateTime.now().UnixTimestamp local createdTime = omIsoDate("T10:49:19.627Z").UnixTimestamp The sum of these two numbers will give you the account’s age in seconds, which you then divide by 86400 to get the account’s age (recall: 86400 seconds = 1 day). local createdTime = omIsoDate("T10:49:19.627Z")Īs you cannot perform arithmetic operations against two DateTime objects you will need to access their UnixTimestamp properties (or Millis if resolution matters, but in the case of this system it does not) which will give you the amount of seconds between these dates and the Unix Epoch. The first thing you will need are two DateTime objects, one that represents your ISO date and one that represents the current moment in time. Gone are the days of needing to find some weird string pattern to be able to work with this format properly. The DateTime class provides a method for converting ISO 8601 dates (the format you’re seeing) into DateTime objects which can then further be used for creating date-based systems. What a time to be working with dates after DateTime was added. If you’re using this API on a Roblox game server and you’re not trying to find the player’s age in days off Roblox, then you’re in luck.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |