Skip to main content
Participating Frequently
March 2, 2012
Question

How do I get a date out of this: 14:35:42.0868394-08:00 ???

  • March 2, 2012
  • 3 replies
  • 790 views

I am receiving an XML document from a person who generates it via a .Net page. This is supposed to be a date/time object.  In his .Net code he uses the object just fine.  I have asked that he translate it to something more standards like {ts '2012-03-01 15:59:45'} but he won't and said I should just figure it out... Nice, huh?

Does anyone have any idea how I can get a date out of this value:

14:35:42.0868394-08:00 ???

I know that the last part (-08:00) refers to Pacific Standard Time.  I am pretty sure that the 14:35:42 represents 2:35:42  PM.  If that is correct, the 0868394 must represent 3/1/2012 (the day I ran the report).

Please help.

This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
March 2, 2012

HugoSchmidt wrote:

I am receiving an XML document from a person who generates it via a .Net page. This is supposed to be a date/time object.  In his .Net code he uses the object just fine.  I have asked that he translate it to something more standards like {ts '2012-03-01 15:59:45'} but he won't and said I should just figure it out... Nice, huh?

Does anyone have any idea how I can get a date out of this value:

14:35:42.0868394-08:00 ???

I know that the last part (-08:00) refers to Pacific Standard Time.  I am pretty sure that the 14:35:42 represents 2:35:42  PM.  If that is correct, the 0868394 must represent 3/1/2012 (the day I ran the report).

-08:00 may indeed refer to the time zone. However, if you're expecting the date-time, then he is shortchanging you. What he has sent you is just the time in hours, minutes and seconds, with the seconds expressed in 7 decimal places.

You could just ignore the decimal places, and extract the time as follows

<cfset datetime_string = "14:35:42.0868394-08:00">

<cfset the_time            = listgetat(datetime_string, 1, ".")>

<cfoutput>#the_time#</cfoutput>

Participating Frequently
March 2, 2012

I think that's only the time, assuming the default fractional

precision of 7 digits for the part after second.

--

Mack

Inspiring
March 2, 2012

I have asked that he translate it to something more standards like {ts '2012-03-01 15:59:45'} but he won't and said I should just figure it out... Nice, huh?

Tell him to act like a bloody professional.

Data-interchange documents (like XML) should use a platform-neutral format (like something ISO-8601 specifies).

And they should document their work, so the composition of that date format should be explained in their documentation, and not over to guesswork on the part of the consumer of the service.

Not much help I know.  But this sort of crap from our colleagues pisses me off.

I tried to work out how that (seemingly decimal part might correspond to a date, but I can't see it.

--

Adam