Convert Java Date to UTC String

前端 未结 7 462
予麋鹿
予麋鹿 2020-11-29 06:09

The java.util.Date toString() method displays the date in the local time zone.

There are several common scenarios where we want the data to be printed in

相关标签:
7条回答
  • 2020-11-29 06:26

    Why not just use java.text.SimpleDateFormat ?

    Date someDate = new Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String s = df.format(someDate);
    

    Or see: http://www.tutorialspoint.com/java/java_date_time.htm

    0 讨论(0)
提交回复
热议问题