bcaudill302
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2016
11:57 AM
Unix Timestamp to Readable format
Does anyone know how to convert a unix timestamp "1460400862" to a readable datetime. I have looked through the sdk and could not find anything but I may have just missed something. Thanks in advance for any help.
7 REPLIES 7

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2016
12:04 PM
Re: Unix Timestamp to Readable format
date = CreateObject("roDateTime")
date.FromSeconds(timestamp)
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
bcaudill302
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2016
12:30 PM
Re: Unix Timestamp to Readable format
Thanks, that did it. For some reason I didn't think that would work. Oh well, guess I was over complicating it. Thanks again.
ajitg_4557
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2018
02:21 AM
Re: Unix Timestamp to Readable format
.....
ajitg_4557
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2018
02:29 AM
Re: Unix Timestamp to Readable format
Please make me understand....where i am doing mistake. Here is my code.
Fill_time=json.FlightInfoExResult.flights[0].filed_time
Fill_time1=Fill_time.ToStr()
Fill_time2=Fill_time1.trim()
now_ok=StrToI(Fill_time2)
date = CreateObject("roDateTime")
EpochToHumanReadableTime=date.FromSeconds(now_ok)
Print"EpochToHumanReadableTime========>>>>>>"EpochToHumanReadableTime
on Telnet i am getting:-
Print"EpochToHumanReadableTime========>>>>>>"<UNINITALIZED>
Fill_time=json.FlightInfoExResult.flights[0].filed_time
Fill_time1=Fill_time.ToStr()
Fill_time2=Fill_time1.trim()
now_ok=StrToI(Fill_time2)
date = CreateObject("roDateTime")
EpochToHumanReadableTime=date.FromSeconds(now_ok)
Print"EpochToHumanReadableTime========>>>>>>"EpochToHumanReadableTime
on Telnet i am getting:-
Print"EpochToHumanReadableTime========>>>>>>"<UNINITALIZED>
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2018
09:36 AM
Re: Unix Timestamp to Readable format
Add more prints (after every statement if you have to).
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
developer34
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2020
09:57 PM
Re: Unix Timestamp to Readable format
i tried the same thing but it is always showing in telnet <UNINITIALIZED>
sub timeConverter() date = CreateObject("roDateTime") seconds = date.FromSeconds(1460400862) ?seconds end sub
i am trying to call the function from init()
Please tell me what i am doing wrong
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020
01:05 AM
Re: Unix Timestamp to Readable format
You're setting seconds to the return value of a function that doesn't return a value, hence the <UNINITIALIZED>. I'm not sure what you're trying to do since you already know the seconds (1460400862). You could do this, but it doesn't get you anywhere:
date = CreateObject("roDateTime") date.FromSeconds(1460400862)
seconds = date.asSeconds() ?seconds
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.