常用类Date时间日期格式
来源:互联网 发布:淘宝旺铺2016年多少钱 编辑:程序博客网 时间:2024/05/18 02:24
package com.sxt.Cyl;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author Rory
* @category 常用类之Date
*/
public class Date1 {
public static void main(String[] args) throws InterruptedException {
//获得当前时间
System.out.println(new Date1());
//获取1970经过x毫秒数后的时间
Date a1=new Date(5658989L);
System.out.println(a1);
//获取1990经过年月日之后的时间
Date a2=new Date(0, 0, 1);
System.out.println(a2);
//控制时间输出格式
Date sj=new Date();
SimpleDateFormat aa=new SimpleDateFormat();
String jg=aa.format(sj);
System.out.println(jg);
//以时钟的形式一致输出
SimpleDateFormat aa1=new SimpleDateFormat("HH:mm:ss");
int l=0;
for (; l <5; l++) {
Date sj1=new Date();
String jg1=aa1.format(sj1);
System.out.println(jg1);
Thread.sleep(1000);
}
System.out.println("5s时间到");
}
}
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author Rory
* @category 常用类之Date
*/
public class Date1 {
public static void main(String[] args) throws InterruptedException {
//获得当前时间
System.out.println(new Date1());
//获取1970经过x毫秒数后的时间
Date a1=new Date(5658989L);
System.out.println(a1);
//获取1990经过年月日之后的时间
Date a2=new Date(0, 0, 1);
System.out.println(a2);
//控制时间输出格式
Date sj=new Date();
SimpleDateFormat aa=new SimpleDateFormat();
String jg=aa.format(sj);
System.out.println(jg);
//以时钟的形式一致输出
SimpleDateFormat aa1=new SimpleDateFormat("HH:mm:ss");
int l=0;
for (; l <5; l++) {
Date sj1=new Date();
String jg1=aa1.format(sj1);
System.out.println(jg1);
Thread.sleep(1000);
}
System.out.println("5s时间到");
}
}
0 0
- 常用类Date时间日期格式
- 时间日期格式转换 sdutoj2246(Date类简单使用)
- 日期时间格式转换为date
- Struts2标签转换Date格式日期时间
- java Date SimpleDateFormate日期时间格式 Calendar
- sqlserver date format(SqlServer常用日期格式)
- JAVA学习笔记:编程常用类-日期时间Date类(java.util.Date)
- Java 把日期时间字符串 格式化为Date对象
- 获取时间日期格式和延时:date、sleep
- Java日期时间(Date/Time):DateFormat格式代码
- Oracle之Date格式转换&日期时间间隔操作
- JAVA将十位时间戳格式化为日期Date类型
- Eclipse 修改注释的 date time 日期时间格式,即${date}变量格式
- Eclipse 修改注释的 date time 日期时间格式,即${date}变量格式
- 日期Date格式判断
- date日期格式转换
- date日期格式转换
- java Date 日期格式
- ubuntu 14.04 64位版本 gcc无法运行 安装ia32-libs提示没有可用的软件包 怎么破
- 第九讲 本地存储
- 331. Verify Preorder Serialization of a Binary Tree
- Java后台框架之一(SpringMVC+MyBatis+Shiro+H5)(0)
- ci表单验证
- 常用类Date时间日期格式
- leetcode——Best Time to Buy and Sell StockⅠ& Ⅱ& Ⅲ & Ⅳ
- bootstrap js控制模态框
- Android bluetooth介绍(一):基本概念及硬件接口
- 8. XSS 攻击
- 杀手数独的计算机求解
- Codeforces 525D Arthur and Walls 【Dfs+思维】
- mysql数据库中文乱码解决办法
- 什么是嵌入式