1.测试Date()

package com.cavaness.quartzbook.chapter3;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 测试Date()
 * @author Kevin
 *
 */
public class DateTest {
	private static Log log = LogFactory.getLog(DateTest.class);
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		DateTest dateTest = new DateTest();
		dateTest.testDate();
		
	}
	
	public void testDate() {
		log.info(new Date()); // 获取当地当前时间
		log.info(new Date().getTime()); // 返回自 1970 年 1 月 1 日 00:00:00 GMT 以来距今的毫秒数
		long milliseconds = 666666666666l;
		log.info(new Date(milliseconds));// 返回自1970 年 1 月 1 日 00:00:00 GMT 过去666666666666l毫秒数后的时间
		log.info(new Date(new Date().getTime())); // 效果和 new Date()一样
	}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值