ISO8601
Utility class what provides bidirectional format transformation between java time objects and ISO8601 format used for metadata date fields.
Methods
parseBasic
Description:
Method | Return values | Description |
---|---|---|
parseBasic(String value) |
String |
Return date from an ISO8601 basic format string. |
value: A ISO86101 basic format string value. |
Example:
package com.openkm;
import com.openkm.util.ISO8601;
import java.util.Calendar;
import java.text.SimpleDateFormat;
public class Test {
public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Calendar cal = ISO8601.parseBasic("20180222000000");
System.out.println(sdf.format(cal.getTime()));
}
}
formatBasic
Description:
Method | Return values | Description |
---|---|---|
formatBasic(Calendar value) |
Calendar |
Return ISO8601 basic format from date. |
value: The date to format. |
Example:
package com.openkm;
import com.openkm.util.ISO8601;
import java.util.Calendar;
public class Test {
public static void main(String[] args) throws Exception {
Calendar cal = Calendar.getInstance();
System.out.println(ISO8601.formatBasic(cal.getTime()));
}
}