xsd datetime format
807605Sep 21 2007 — edited Sep 21 2007Hi, I'm using a javascript popup calendar on a web page which can return a timestamp in either of 3 formats (i can choose whichever):
dd-mm-yyyy hh:mm:ss
mm/dd/yyyy hh:mm:ss
yyyy-mm-dd hh:mm:ss
I want to convert this form value into the xsd datetime format yyyy-MM-ddThh:mm:ss.
How can I do this?
I have been using the following code, but this just deals with today's date. I need to alter it so that it can deal with the value from the popup calendar:
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
StringBuffer sb = new StringBuffer( sdf.format(calendar.getTime()) );