Created
March 19, 2014 22:24
-
-
Save jayschwa/9652728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Alejandro Rivera (alejrivera@ebay.com) | |
* @since 2014-03-13 17:23 | |
*/ | |
@JsonSerialize(using = JsonDateSerializer.class) | |
public class DateTime extends java.util.Date { | |
public DateTime(long date) { | |
super(date); | |
} | |
/** | |
* Returns an ISO 8601 String representing the date. | |
*/ | |
@Override | |
public String toString() { | |
return ISO8601Utils.format(this, true, TimeZone.getTimeZone("UTC")); | |
} | |
/** | |
* This function will be used by Jersey when trying to parse query/path parameters. | |
*/ | |
public static DateTime valueOf(String date) { | |
return new DateTime(ISO8601Utils.parse(date).getTime()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment