mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-20 11:10:07 +02:00
26 lines
569 B
Java
26 lines
569 B
Java
package com.wisemapping.util;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.TimeZone;
|
|
|
|
final public class TimeUtils
|
|
{
|
|
private static SimpleDateFormat sdf;
|
|
static {
|
|
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
|
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
}
|
|
|
|
public static String toISO8601(@Nullable Date date) {
|
|
String result = "";
|
|
if (date != null) {
|
|
result = sdf.format(date) + "Z";
|
|
}
|
|
return result;
|
|
}
|
|
|
|
}
|