java实现获取当前年月日 小时 分钟 秒 毫秒
java代码实现如下
/** |
* |
*/ |
public static String"yyyy-MM-dd"; |
|
/** |
* |
*/ |
public static String"yyyy-MM-dd; |
|
/** |
* |
*/ |
public static String"yyyy-MM-dd; |
|
/** |
* |
*/ |
public static String"yyyy年MM月dd"; |
|
/** |
* |
*/ |
public static String"yyyy年MM月dd日 ; |
|
/** |
* |
*/ |
public static String"yyyy年MM月dd日 ; |
/** |
* |
*/ |
public static String |
SimpleDateFormatnew SimpleDateFormat(FORMAT_FULL); |
Calendar |
return df.format(calendar.getTime()); |
} |
/** |
* |
* |
* |
*/ |
public static String |
return format(date).substring(0, 4); |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static int getMonth(Date |
calendar |
calendar.setTime(date); |
return calendar.get(Calendar.MONTH)1; |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static int getDay(Date |
calendar |
calendar.setTime(date); |
return calendar.get(Calendar.DAY_OF_MONTH); |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static int getHour(Date |
calendar |
calendar.setTime(date); |
return calendar.get(Calendar.HOUR_OF_DAY); |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static int getMinute(Date |
calendar |
calendar.setTime(date); |
return calendar.get(Calendar.MINUTE); |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static int getSecond(Date |
calendar |
calendar.setTime(date); |
return calendar.get(Calendar.SECOND); |
} |
/** |
* |
* |
* |
* |
* |
*/ |
public static long getMillis(Date |
calendar |
calendar.setTime(date); |
return calendar.getTimeInMillis(); |
} |
java实现获取当前年月日 小时 分钟 秒 毫秒的更多相关文章
- JavaScript秒转换成天-小时-分钟-秒
根据时间秒转换成天-小时-分钟-秒 // 秒转换成day.hour.minutes.seconds formatSecond(second: number) { const days = Math.f ...
- 【PTA】5-2 下列程序读入时间数值,将其加1秒后输出,时间格式为:hh: mm: ss,即“小时:分钟:秒”,当小时等于24小时,置为0。
5-2 下列程序读入时间数值,将其加1秒后输出,时间格式为:hh: mm: ss,即"小时:分钟:秒",当小时等于24小时,置为0. #include <stdio.h> ...
- IOS第18天(4,核心动画,时钟效果,定时器,图片旋转角度,CALayer 锚点,获取当前,小时,秒,分)
**** #import "HMViewController.h" // 每秒秒针转6度 #define perSecendA 6 // 每分钟分针转6度 #define perM ...
- SQL计算时间差,要精确到小时分钟秒
declare @starttime as datetime declare @endtime as datetime set @starttime = '2009-11-24 15:10:00' s ...
- Js Jquery 时间控件显示小时 分钟 秒
// ui.js 自带的datepicker 插件只能显示日期不能显示时分秒 使用dateTimePicker可以显示时间 效果图: 首先需要引用 js和css 注意 ui.js的顺序要在s ...
- java如何获取当前时间,精确到毫秒
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; //func1 Calenda ...
- JS计算两个日期时间差,天 小时 分 秒格式
function diffTime(startDate,endDate) { startDate= new Date(startDate); endDate = new Date(endDate); ...
- java中获取日期和时间的方法总结
1.获取当前时间,和某个时间进行比较.此时主要拿long型的时间值. 方法如下: 要使用 java.util.Date .获取当前时间的代码如下 Date date = new Date(); da ...
- Java Calendar获取年、月、日、时间
Java Calendar获取年.月.日.时间 Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00" ...
随机推荐
- 命令行批量修改IP并ping测试
@echo off set ip=0 :beginset /a ip=%ip%+1netsh interface ip set address "本地连接" static 172. ...
- [转帖]Marvell兵败中国4G 创始人去职未来几何
Marvell兵败中国4G 创始人去职未来几何 (2016-04-12 09:08:30) 2016年的帖子. http://blog.sina.com.cn/s/blog_1542ef86c0102 ...
- Pyhton语句
一.if条件语句 1.python 并不支持 switch 语句 num = 5 if num == 3: # 判断num的值 print 'boss' elif num == 2: print 'u ...
- Fidder 网络抓包调试工具
可参考文章:[HTTP]Fiddler(二) - 使用Fiddler做抓包分析 fiddler2抓包工具使用图文教程
- 一本通1587【例 3】Windy 数
1587: [例 3]Windy 数 时间限制: 1000 ms 内存限制: 524288 KB 题目描述 原题来自:SCOI 2009 Windy 定义了一种 Windy 数:不含前 ...
- scrapy 简单爬虫实验
利用python的模块requests来爬取百度搜索出来的url 使用环境为python3 #!/use/bin/env python # -*- coding:utf-8 -*- import re ...
- BZOJ1002 [FJOI2007] 轮状病毒 【递推】
题目分析: 推基尔霍夫矩阵后可以发现递推式 代码: n = input() f0 = 1 f1 = 5 f3 = 0 if n == 1: print f0 elif n == 2: print f1 ...
- linux上搭建nginx
安装包:(按顺序执行过去即可,重复无所谓)c++编译环境 yum install gcc-c++ 安装pcre yum -y install pcre-devel 安装openssl yum -y i ...
- MT【43】抛物线不常见性质2.
注:S为抛物线焦点
- MT【4】坐标平移后齐次化
简答:通过坐标平移可以将A点移到原点,设BC:mx’+ny’=1,联立坐标变换后的椭圆方程和BC,将$\frac{y}{x}$看成斜率k,得到关于k的一元二次方程,由题意两根之积为-1,可得.