import java.text.SimpleDateFormat
long lTime = new Date().time
String formattedDate = getUTCDateString(lTime)
println formattedDate
def getUTCDateString(long lTime)
{
Date lDate = new Date(lTime)
def cal = new GregorianCalendar(TimeZone.getTimeZone('UTC'))
cal.set(lDate[Calendar.YEAR],lDate[Calendar.MONTH],lDate[Calendar.DATE],lDate[Calendar.HOUR_OF_DAY],lDate[Calendar.MINUTE],lDate[Calendar.SECOND])
String formattedDate = new SimpleDateFormat("yyyy-mm-dd hh:mm").format(cal.time);
return formattedDate
}
No comments:
Post a Comment