real millisecs / unix timestamp
Monkey Forums/Monkey Programming/real millisecs / unix timestamp
| ||
Hi I'm sure I read that this function now existed, but maybe it was removed in v67. Is there a way to get the unix timestamp in monkey? |
| ||
Diddy has a function that will return the unix timestamp called "RealMillisecs" : https://bitbucket.org/swoolcock/diddy/overview |
| ||
A UTC-formatted timestamp is "YYYY-MM-DDTHH:MM:SSZ". How do I get that from diddy's RealMillisecs()? (I don't see a way to make diddy spit out "03" for March (using GetMonth()) instead of just "3".) [monkeycode] Local ts:String = GetYear() + "-" + GetMonth() + "-" + GetDayOfMonth() + "T" + GetHours() + ":" + GetMinutes() + ":" + GetSeconds() + "Z" [/monkeycode] |
| ||
Couldnt you do:Function TwoDigitMonth:String() Local GMonth:String = GetMonth if GMonth.Length<2 then Return "0"+GMonth 'if its 1 then its <10 so we need a 0 on the front Return GMonth End :D |
| ||
Couldnt you do:Function TwoDigitMonth:String() Local GMonth:String = GetMonth if GMonth.Length<2 then Return "0"+GMonth 'if its 1 then its <10 so we need a 0 on the front Return GMonth End :D |
| ||
Couldnt you do:Function TwoDigitMonth:String() Local GMonth:String = GetMonth if GMonth.Length<2 then Return "0"+GMonth 'if its 1 then its <10 so we need a 0 on the front Return GMonth End :D |
| ||
Yes. Yes. Yes. :-D It would be better if we could get something like: diddy.UTCTime() or diddy.RealMillisecs("Y-M-D\TH:M:S\Z") :-) |
| ||
Crikey never had triple post before :s Yeah I do agree but sometimes its the coder that has to provide the workaround :D |