package com.zxwl.ahgj.demo;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Demo3
{
public static void main(String[] args)
{
String s_date = "2016-08-03 23:22:43";
SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = sFormat.parse(s_date);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("date1"+date.toLocaleString());
System.out.println(sFormat.format(date));
System.out.println(date.getTime());
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(date);
// calendar.add(calendar.DATE, 1);
// String newString = sFormat.format(calendar.getTime());
date.setDate(date.getDate()+1);
System.out.println("xxx"+date.toLocaleString());
}
}
时间转换
最新推荐文章于 2023-10-30 23:05:37 发布