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" ...
随机推荐
- linux和Mac上安装composer
使用命令行方式,可以直接使用下面的命令,顺序执行: php -r "copy ('https://getcomposer.org/installer','composer-setup.php ...
- shell脚本--函数
shell的函数和Javacript和php的函数声明一样,只不过shell在调用函数的时候,只需要写函数名就可以调用函数,注意不要在函数名后面加括号 创建并使用函数 #!/bin/bash #文件名 ...
- Eclipse——Note
Eclipse中常用的快捷键 快捷键 功能
- Building Java Projects with Gradle
https://spring.io/guides/gs/gradle/ Gradle学习系列教程 https://blog.csdn.net/column/details/gradle-transla ...
- Solution of wireless link "PCI unknown" on Centos 7.1
Pick From http://www.blogjava.net/miaoyachun/archive/2015/09/17/427366.html After Centos 7.1 tobe in ...
- 应用层协议及ip地址划分
1.应用层协议 2.ip地址 3.子网划分及超网合并
- python 时间转换相关
最近需要操作时间的地方相当的多,包括打点,包括时间转换. 罗列最近遇到的两个需求. 1. 关于上篇文章写的base64上传图片的问题,我使用了打点来计算解码需要多少时间.这个对时间精度要求是比较高的. ...
- jmeter创建数据库测试计划
这个例子要:创建50个用户发送2个sql请求到数据库服务器, 也可设置用户重复执行100次,这样总的请求数=50*2*100 用到以下元素:thread group / jdbc request / ...
- Delphi+DBGrid导出Excel
uses ComObj; //DBGrid:指定的DBGrid;SaveFileName:要保存的文件名 function ExportDBGrid(DBGrid: TDBGrid; SaveFile ...
- BZOJ[Usaco2017 Jan]Promotion Counting——线段树合并
题目描述 The cows have once again tried to form a startup company, failing to remember from past experie ...