Here you can find the source of dateTimeToZuluFormat(DateTime dateTime)
Parameter | Description |
---|---|
dateTime | specific dateTime in joda datetime format. |
public static String dateTimeToZuluFormat(DateTime dateTime)
//package com.java2s; //License from project: Open Source License import org.joda.time.DateTime; import java.text.SimpleDateFormat; import java.util.TimeZone; public class Main { /**//from ww w . j a va 2 s . c o m * * @param dateTime specific dateTime in joda datetime format. * @return YYYY-MM-DD hh:mm:ss in ZULU (UTC)format */ public static String dateTimeToZuluFormat(DateTime dateTime) { final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss:SSzzz"; final SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT); final TimeZone utc = TimeZone.getTimeZone("UTC"); sdf.setTimeZone(utc); return sdf.format(dateTime.toDate()); } }