package com.mc.others;

public class UTCTimeTest {
@Test
public void test1() {
Calendar calendar = Calendar.getInstance();
DateFormat dtf = new SimpleDateFormat("yyyyMMdd'T'HHmmssZ");
Date now = calendar.getTime();
String format = dtf.format(now);
System.out.println(format);//20160803T222649+0800
}
@Test
public void test2() {
Date now = new Date();
DateFormat dtf = new SimpleDateFormat("yyyyMMdd'T'HHmmssZZ");
String format = dtf.format(now);
System.out.println(format);//20160803T221641+0800
}
@Test
public void test3() {
// org.joda.time.DateTime;
DateTime dateTime = new DateTime();
String format = dateTime.toString();
System.out.println(format);//2016-08-03T22:14:19.293+08:00
}
@Test
public void test4() {
DateTime dateTime = new DateTime();
String format = dateTime.toString("yyyyMMdd'T'HHmmssZZ");//20160803T221822+08:00
System.out.println(format);
}
}

相关文章:

  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2021-12-17
  • 2022-01-22
  • 2021-10-21
  • 2022-03-02
  • 2022-03-14
猜你喜欢
  • 2021-07-06
  • 2022-02-07
  • 2021-11-06
  • 2021-10-08
  • 2021-09-10
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案