Skip to content
Snippets Groups Projects
Commit c5874bcd authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added ISO format method

parent 5444aa5a
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,10 @@
package no.nibio.vips.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/**
* Adding some utils to the java.util.Date class!
......@@ -28,13 +30,17 @@ import java.util.Date;
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class XDate extends java.util.Date{
private SimpleDateFormat ISOUTCFormat;
public XDate(){
super();
ISOUTCFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
ISOUTCFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
public XDate(Date date)
{
super();
this();
this.setTime(date.getTime());
}
......@@ -167,4 +173,13 @@ public class XDate extends java.util.Date{
cal.add(Calendar.YEAR, years);
this.setTime(cal.getTime().getTime());
}
/**
* TODO Check that this actually returns an ISO compliant string
* @return
*/
public String getISOUTCFormat()
{
return this.ISOUTCFormat.format(this);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment