2
votes

Does anyone know how to get actionscript to render a null date value '000:00:00T00:00:00'? I am calling a web service that expects date fields in the SOAP xml. I need some of these dates to serialize as null and I can't see how to produce null. The closest value I can get is '1899-11-30T00:00:00Z'. Below is the code I am using:

var dateStr:String = "0000-00-00T00:00:00+"; var emptyDate:Date = DateUtil.parseW3CDTF(dateStr); newReqData.DateTimeInit = emptyDate;

2
what is the type of DateTimeInit ? Isn't there a way to initialize otherwise than by passing a Date (which is hardly set to 0000...) - Theo.T
The type is Date. The problem I am having is not with formatting, it is with the serialization. I want the SOAP call to render the universal NULL date, which I believe is '0000-00-00T00:00:00'. My .Net implementation of this web service call renders this value in the XML post. The Flex implementation does not. It renders '1899-11-30T00:00:00Z'. So the end result is that I get a date of '11/30/1899' in the database which is not desireable. With the .Net implementation, I get a nice NULL in the database. - Jim

2 Answers

0
votes

You can probably do it with a date formatter. You'll have to create a Date object but if you pass it to the DateFormatter, you can set the format to pretty much whatever you like. Here's the reference and I would recommend looking at the "Other Text" area:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html

0
votes

var d:Date=new Date(); d.setTime(-62167226400000); Alert.show(d.toString());

or as said Shawn Yale, read this.