#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Independently configure date format for XML/JSON serialization


    How do I configure the date format independently for each of my date fields?
    For example, let's say I have a CustomerOrder class with more than 1 java.util.Date fields in it.
    I need to be able to render like this:

    <customerOrder>
    <orderDate>2013-01-04T20:50:42.769Z</orderDate>
    <user>Bob</lastUpdateUser>
    <state>CO</state>
    <estShipDate>2013-01-04</estShipDate>
    </customerOrder>

    So one of the dates may not care about the hh:mm:ss.
    i.e. I cannot format every date the same way.
    Any ideas?

    This is my technology stack:

    - Jersey 1.16
    - Enunciate 1.26.2
    - Spring 3.1.2
    - Hibernate 4.1.7
    - JPA 2.0.3
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    119
    Rep Power
    0
    Hi Dear

    Please follow these link :

    http://www.date4j.net/
    and java doc for the same is : http://www.date4j.net/javadoc/hirondelle/date4j/DateTime.html
    example from SVN : https://github.com/nahi/date4j-import/blob/master/classes/hirondelle/date4j/DateTimeInterval.java

    Thanks
    Diya

IMN logo majestic logo threadwatch logo seochat tools logo