leeladhar
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2010
05:53 AM
How to get time part from roDateTime
Hi,
I am trying to do below, I have a date and time string which is in GMT and i want to have that printed in Roku devices timezone.
Here is the code I was trying
datestr = "2010-11-15 04:30:00.000"
dt = CreateObject("roDateTime")
dt.fromISO8601String(datestr)
'GMT Time
print "Date = " + dt.asDateString("long-date") + tostr(dt.getHours()) + ":" + tostr(dt.getMinutes()) + ":" + tostr(dt.getSeconds())
'Local Time
dt.toLocalTime()
print "Date = " + dt.asDateString("long-date") + tostr(dt.getHours()) + ":" + tostr(dt.getMinutes()) + ":" + tostr(dt.getSeconds())
Output I am getting is as below, Our Roku device is set to Eastern TimeZone
Date = Monday November 15, 20104:30:0
Date = Sunday November 14, 201023:30:0
I need to have the time part properly shown above, Am I doing something wrong in getting time ??
I am trying to do below, I have a date and time string which is in GMT and i want to have that printed in Roku devices timezone.
Here is the code I was trying
datestr = "2010-11-15 04:30:00.000"
dt = CreateObject("roDateTime")
dt.fromISO8601String(datestr)
'GMT Time
print "Date = " + dt.asDateString("long-date") + tostr(dt.getHours()) + ":" + tostr(dt.getMinutes()) + ":" + tostr(dt.getSeconds())
'Local Time
dt.toLocalTime()
print "Date = " + dt.asDateString("long-date") + tostr(dt.getHours()) + ":" + tostr(dt.getMinutes()) + ":" + tostr(dt.getSeconds())
Output I am getting is as below, Our Roku device is set to Eastern TimeZone
Date = Monday November 15, 20104:30:0
Date = Sunday November 14, 201023:30:0
I need to have the time part properly shown above, Am I doing something wrong in getting time ??
2 REPLIES 2

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2010
07:09 AM
Re: How to get time part from roDateTime
Looks mostly ok to me. You need a space or something between the year and the hour, and you probably want to ensure that the minutes and seconds are zero padded to two digits if they're less than 10.
--Mark
--Mark
leeladhar
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2010
08:18 AM
Re: How to get time part from roDateTime
Oh, Thanks, my mistake didn't look over on that.
leeladhar
leeladhar