renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2010
12:53 AM
roDateTime fromISO8601String
I'm trying to initialize an roDateTime object from an ISO8601 date/time string. From the Roku DVP Component Reference:
The first thing to note is that the example does not follow the ISO8601 standard, it should be "2009-01-01T01:00:00.000". But, that doesn't work either. I've tried every possibility of moving the year around, with and without fractional seconds, with and without timezone offsets, etc., but the following code always shows that the date/time object never changes:
I can change the value using the fromSeconds() function, but not the fromISO8601String() function.
Have I just not stumbled upon the magic string to make the function happy, or is it safe to say that this isn't really implemented even though it's in the documentation?
-JT
Void fromISO8601String(String dateString)
• Initialize the date/time using a string in the ISO8601 format. For example “01-01-2009T01:00:00.000â€
The first thing to note is that the example does not follow the ISO8601 standard, it should be "2009-01-01T01:00:00.000". But, that doesn't work either. I've tried every possibility of moving the year around, with and without fractional seconds, with and without timezone offsets, etc., but the following code always shows that the date/time object never changes:
dt = CreateObject("roDateTime")
print dt.asSeconds()
dt.fromISO8601String("2009-01-01T01:00:00.000")
print dt.asSeconds()
I can change the value using the fromSeconds() function, but not the fromISO8601String() function.
Have I just not stumbled upon the magic string to make the function happy, or is it safe to say that this isn't really implemented even though it's in the documentation?
-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.
5 REPLIES 5
nowhereman
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2010
08:16 AM
Re: roDateTime fromISO8601String
"renojim" wrote:
Have I just not stumbled upon the magic string to make the function happy, or is it safe to say that this isn't really implemented even though it's in the documentation?
-JT
I spent some time a while back trying to use this function and had the same results. I never did find a string that worked with it.
twitter:nowhereman
http://www.thenowhereman.com/roku
http://www.thenowhereman.com/netflix
http://www.thenowhereman.com/roku
http://www.thenowhereman.com/netflix

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2010
09:39 AM
Re: roDateTime fromISO8601String
This is indeed a bug.... The roDateTime.fromISO8601String() method is not actually accepting ISO8601 strings. We are not recognizing the "T" in the example above (or any other letters eg "Z" in the iso8601 string)
If you try to initialize using your code above, but replacing the "T" with a "-" you will get better results.
dt = CreateObject("roDateTime")
print dt.asSeconds()
dt.fromISO8601String("2009-01-01-01:00:00.000")
print dt.asSeconds()
We will fix this to better support ISO8601 strings in a future release. For now, only use date strings like the format above without letters in it.
--Kevin
If you try to initialize using your code above, but replacing the "T" with a "-" you will get better results.
dt = CreateObject("roDateTime")
print dt.asSeconds()
dt.fromISO8601String("2009-01-01-01:00:00.000")
print dt.asSeconds()
We will fix this to better support ISO8601 strings in a future release. For now, only use date strings like the format above without letters in it.
--Kevin
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2010
01:11 PM
Re: roDateTime fromISO8601String
Thanks, that did it.
Well... I take it back. Entering the string as "2010-04-26-01:01:01.000" does change the value, but the new value is off by more than 7 million seconds. Changing the time doesn't affect the value either and in fact the time portion of the string can be left off completely.
-JT
Well... I take it back. Entering the string as "2010-04-26-01:01:01.000" does change the value, but the new value is off by more than 7 million seconds. Changing the time doesn't affect the value either and in fact the time portion of the string can be left off completely.
-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.

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2010
04:49 PM
Re: roDateTime fromISO8601String
Try strings like:
"2010-04-26 00:00:00.000"
"2010-04-26 16:45:00.000"
"2010-04-26 00:00:00.000"
"2010-04-26 16:45:00.000"
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2010
03:31 PM
Re: roDateTime fromISO8601String
Ahh... that was it! And I thought I tried every combination of date and time.
Now if I could just remember why I was looking into this in the first place...
Thanks again,
-JT
Now if I could just remember why I was looking into this in the first place...
Thanks again,
-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.