时间格式转化成string工具类:

package cn.javass.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date; public class DateFormatUtil {
private DateFormatUtil(){} public enum DateFormatStyleEnum{
YMD("yyyy-MM-dd"),YMDHMS("yyyy-MM-dd HH:mm:ss");
private String str = "";
private DateFormatStyleEnum(String str){
this.str = str;
}
public String getStr(){
return this.str;
} }
public static String data2Str(DateFormatStyleEnum dfStyle,long time){
DateFormat df = new SimpleDateFormat(dfStyle.getStr());
return df.format(new Date(time));
}
}

时间格式转化 String2datestyle的更多相关文章

  1. Sql server 时间格式转化

    --.SQL时间格式转化 --日期转换参数 ) --2009-03-15 15:10:02 ),'-',''),' ',''),':','') ) , ) --2009/03/15 ) , ) ) , ...

  2. 29-jsp中用js进行时间格式转化

    CST可以为如下4个不同的时区的缩写: 美国中部时间:Central Standard Time (USA) UT-6:00 澳大利亚中部时间:Central Standard Time (Austr ...

  3. oracle 时间格式转化以及计算

    --A表中的日期字段 create_date   例如:2017-08-05  转化为2017年8月5日   oracle 在这里的双引号会忽略 select to_char(to_date(tt.c ...

  4. win7 蛋疼的时间格式转化

    win7系统 获得系统时间为 2015年1月1日 星期5 10:10 数据库中时间格式 是不认识的 转化为 DateTime.Now.ToString("yyyy-MM-dd HH:mm:s ...

  5. Excel中将时间格式转化成时间戳格式

    时间戳转成正常日期的公式:C1=(A1+8*3600)/86400+70*365+19其中A1表示当时的1249488000时间戳数值其中C1就是所需的日期格式,C1单元格属性改成日期格式就可以了.正 ...

  6. 21-js 实现评论时间格式转化

    js里面要用可以用伊尔表达式,循环是用js: document.getElementById("${pj.pltime }").innerHTML = dateToGMT(&quo ...

  7. python:时间格式转化

    1.获取秒级时间戳与毫秒级时间戳.微秒级时间戳 import time import datetime t = time.time() print (t) #原始时间数据 print (int(t)) ...

  8. DateTime.TryParseExact 万能时间格式转化

    本文转载:http://blog.csdn.net/gaofang2009/article/details/6073231 前天同事问C#有没有相关的方法能把"年月日时分秒"这样的 ...

  9. java 不同时间格式转化

    今天项目中遇到一个格式问题,收到的timestamp格式是2019-08-19-16:03:21 , 但是入es时,当类型为date的时候,这种格式直接报错,因为索引建的格式是yyyy-MM-dd H ...

随机推荐

  1. Oracle中快速查询和操作某个用户下的所有表数据信息

    一.禁止所有的外键约束 在pl/sql developer下执行如下语句:SELECT 'ALTER TABLE ' || table_name || ' disable CONSTRAINT ' | ...

  2. DataSet读取XML

    string file = File.ReadAllText("c://123.xml", Encoding.Default); using (DataSet ds = new D ...

  3. 用EXcel制作不同背景的图

    Excel 绘图区分区设置不同背景色 之 条形图 样图 在Excel图表中,如对绘图区设置背景色,一般只能对整个绘图区设置同一种颜色.图案或图片为背景.但有时希望能对不同的分区设置不同的颜色作为背景, ...

  4. Android Service 文档

    应用场景: 1  用于将后台逻辑(Service中)和UI逻辑(Activity中)进行解耦,实现Service功能的复用,为其他程序提供功能. 2  后台功能,由于Activity在进入后台时(On ...

  5. CPU阿甘

    本系列文章全部摘选自"码农翻身"公众号,仅供个人学习和分享之用.文章会给出原文的链接地址,希望不会涉及到版权问题. 个人感言:真正的知识是深入浅出的,码农翻身" 公共号将 ...

  6. IDE神器intellij idea的基本使用

    摘自: http://www.cnblogs.com/newpanderking/p/4887981.html 一.编码快捷键(比较常用的快捷键)该套快捷键选择的是:Mac OS X 10.5+ 1. ...

  7. Oracle 查询类似 select top 的用法

    --查询前10条数据select * from MID_EHR_STAFF where rownum<10;--查询第5~10条的记录,minus(减)select * from MID_EHR ...

  8. Oracle Database 11G R2 标准版 企业版 下载地址(转)

    转自:http://blog.itpub.net/628922/viewspace-759245/ 不需要注册,直接复制到迅雷或其他下载软件中即可下载. oracle 11.2.0.3 下载地址: L ...

  9. 现成的HTML5框架

    1>sencha-touch 2>phoneGap 3>jQuery mobile 4>bootstrap

  10. C#获取操作系统是32位或64位的代码

    注意需添加引用System.Management) public static string Distinguish64or32System() { try { string addressWidth ...