• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

WDDX (de)serializes dateTime with wrong DST rules?

New Here ,
Apr 09, 2009 Apr 09, 2009

Copy link to clipboard

Copied

2006-Aug-20 00:00 is being translated to 2006-Aug-19 23:00.  That date was in Pacific Daylight Time (-7) but the result seems to be -8 (PST).

I created a Web Service in Lotus Domino 7 and consume it in Coldfusion 8.  I've always returned data to Coldfusion as strings and thought I'd try passing a dateTime.  My Java code uses a kludge to get the ISO8601 date right:

("sb_" = java.lang.StringBuffer; "s__" = java.lang.String; "ca_" = java.util.Calendar)

df_SimpleWddx = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" );
s__Kludge = df_SimpleWddx.format( ca_Began.getTime() );

sb_Wddx.append( "<var name='dt_Began'><dateTime>" + s__Kludge.substring( 0, 22 ) + ":" + s__Kludge.substring( 22 ) + "</dateTime></var>" );

My Coldfusion code:

("dx_" = WDDX data; "st_" = Coldfusion structure)

<cfwddx action="wddx2cfml" input="#dx_BadDates#" output="st_BadDates" />

<cfdump var="#st_BadDates#" />

Seeing {ts '2006-08-19 23:00:00'} in <cfdump>, I changed my Java code to:

sb_Wddx.append( "<var name='dt_Began'><string>" + s__Kludge.substring( 0, 22 ) + ":" + s__Kludge.substring( 22 ) + "</string></var>" );
and got "2006-08-20T00:00:00-07:00" (which is correct).

Unless I'm totally lost, Domino (running JVM 1.4.2_11) is sending the date correctly but <cfwddx> isn't turning it into a dateTime correctly.  I'm running the Developer version of Coldfusion (on my local XP machine) and Coldfusion's JVM is 1.6.0_04.

Has anyone else fought this battle but won?

TOPICS
Advanced techniques

Views

4.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Apr 21, 2009 Apr 21, 2009

sorry it was a test to show adobe that email replies w/quotes show up blank in

the forums.

i'll be submitting the wddx DST issue to adobe as a bug. in the meantime you'll

probably have to workaround it. i guess test if the date is in DST & adjust it

back once it's converted from wddx.

Votes

Translate

Translate
New Here ,
Apr 22, 2009 Apr 22, 2009

Copy link to clipboard

Copied

LATEST

Why thank you, cfSearching - that was kind.  Sadly, I am far, far better at code than humor (and my code isn't stellar).

Paul, a friend showed me a workaround at cflib.org but mine was a little shorter:

Web Service side ("sb_" = java.lang.StringBuffer; "dt_" = java.util.Date)

df_Wddx = new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" );

...

sb_WddxPacket.append( "<var name='s__Begins'> );

sb_WddxPacket.append( "     <string>" + df_Wddx.format( dt_Begins ) + "</string>" );

sb_WddxPacket.append( "</var>" );

...

return sb_WddxPacket.toString();

ColdFusion side ("st_" = Structure; "dt_" = DateTime)

<cfinvoke component      = "WebService"
          returnvariable = "st_WddxPacket"
          ... />

<cfset df_Wddx   = CreateObject( "java", "java.text.SimpleDateFormat" ) />
<cfset df_Wddx.applyPattern( "yyyy-MM-dd'T'HH:mm:ssZ" ) />
<cfset dt_Begins = df_Wddx.parse( st_WddxPacket.s__Begins ) />

It ignores the colon that's supposed to be in the timezone offset but, since Java is talking to Java, it's OK.

Thanks for submitting the bug for me!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation