Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
aarongough
Visitor

Timestamp issues

Hey all.
I'm having weird issues with timestamps in Brightscript.

As I understand it you get a timestamp in Brightscript like so:

dt = createObject("roDateTime")
dt.mark()
print str(dt.asSeconds())


But when I do this I get values like: 1.311792e+09

Is there any way to get a sane unix timestamp on the Roku?
Thanks.
-A
0 Kudos
1 REPLY 1
TheEndless
Channel Surfer

Re: Timestamp issues

It's the Str() that's converting the number like that. If you just want to print to the console, then "print dt.AsSeconds()" should work. If you need to convert it to a pretty string for your app to use, you can try "dt.AsSeconds().ToStr()".
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)
0 Kudos