Is there a simple way in AM script to convert a time in the Unix epoch format to a date and time?
I don't see this option in the date formats.
sqlite can take care of the conversion, but it seems a content provider can only return the raw value?
Thanks!
Convert unix epoch to date and time
Moderator: Martin
Re: Convert unix epoch to date and time
You can use {variable,dateformat,dd.MM.yyyy HH:mm:ss} to format milliseconds since 1970 to a string. You can also use {variable*1000,dateformat,dd.MM.yyyy HH:mm:ss} if you have the unix epoch in seconds. The content provider most likely contains milliseconds.
You can use a script to convert a string like "20.02.2016 13:00" to the milliseconds since 1970:
Also check the help page of action Script, section String Inline Expressions and Date Format Pattern
Regards,
Martin
You can use a script to convert a string like "20.02.2016 13:00" to the milliseconds since 1970:
Code: Select all
variable = "20.02.2016 13:00";
datetime = getDate(variable, "dd.MM.yyyy HH:mm");
Regards,
Martin
Re: Convert unix epoch to date and time
Ah, it seems I have been overcomplicating this.
Thanks!
Thanks!