0

I have a ValueObject in Java Source Code with a java.util.Date or java.sql.Date attribute and in Flex-AS3 have a DTO mapped by [RemoteClass] using a Date AS3 Type. When I set a date in Flex with 2010-09-05 format YYYY-MM-DD in DateField component and send it to Java, java shows 2010-09-04 there is a difference of a day from flex to java

I'm using Java EJB Service + GraniteDS + RemoteObject to comunication.

Thanks!

  • 1
    Is there maybe a difference between GMT your Application Server is configured with and GMT of the system that you're testing your Flex application on? I've got this issue with Liferay, where Tomcat was by default configured to use GMT+0 while I was testing my application on Windows with GMT+1. So while I was sending ex. 2010-09-05 from Flex it was coming to Tomcat as 2010-09-04 23:00 – 2DH Dec 08 '10 at 13:53

1 Answers1

1

I found that the best way of exchanging dates between flex and the backend is to use string literals. Otherwise, you will have to take care of the time zone differences between client and server - that's why you see different dates. If you will search stackoverflow you will find more topics discussing about that.

Cornel Creanga
  • 5,311
  • 1
  • 22
  • 28
  • It's maybe the easiest way but I hardly find it 'best'. Consider following situation: you're preparing SMS campaign saying 'If you buy christmas tree at our shops before 12:00 you'll get 2 free glass balls'. So you're setting start date to 2010-12-24 09:00 and end date to 2010-12-24 12:00. Let's say you're doing that 2010-12-24 at 08:00 in Chicago and that database is located in Warsaw (that's 7h difference). I hope that you can see the problem here. At 8 am Chicago time it's 3pm in Warsaw so campaign defined like that will never start. With date passed as Date this problem is non-existent. – 2DH Dec 08 '10 at 22:30
  • Yes, I agree that in your case you will want to pass the date as a Date, because you care about the timezone difference. Most of my cases were not implying that. – Cornel Creanga Dec 09 '10 at 10:31