Timestamp_时间戳

时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。

package timestamp;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

import freemarker.template.SimpleDate;

public class Test_timestamp {

  /**
  * @param args
  */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String str = sdf.format(new Date().getTime()).toString();
    System.out.println(str+"-------------1");

    Timestamp ts = new Timestamp(System.currentTimeMillis());
    //String->Timestamp
    System.out.println(ts.valueOf(str)+"-------------2");

    //Timestamp->String
    System.out.println(sdf.format(ts).toString()+"-------------3");

    //Timestamp->Date
    Date date = new Date() ;
    date = ts;
    System.out.println(date+"-------------4");

    //Date->Timestamp
    //父类 子类
    Timestamp ts1 = new Timestamp(new Date().getTime());
    System.out.println(ts1);
  }

}

  

时间: 2024-07-28 20:26:48

Timestamp_时间戳的相关文章

jBPM 4.4 数据库设计

1         存储流程定义相关的部署信息数据库 1.1              jbpm4_deployment 字段名 字段含义 类型 允许空值 键 DBID_ 流程模板标识 Bigint(20) 主键 NAME_ 流程模板名称 longtext √ TIMESTAMP_ 时间戳 Bigint(20) √ STATE_ 可用状态 Varchar(255) √ 1.2              jbpm4_deployprop 字段名 字段含义 类型 允许空值 键 DBID_ 属性标识

如何设计一款跨平台低延迟的RTMP/RTSP直播播放器

开发背景 2015年,当我们试图在市面上找一款专供直播播放使用的低延迟播放器,来配合测试我们的RTMP推送模块使用时,居然发现没有一款好用的,市面上的,如VLC或Vitamio,说白了都是基于FFMPEG,在点播这块支持格式很多,也非常优异,但是直播这块,特别是RTMP,延迟要几秒钟,对如纯音频.纯视频播放,快速启播.网络异常状态处理.集成复杂度等各方面,支持非常差,而且因为功能强大,bug很多,除了行业内资深的开发者能驾驭,好多开发者甚至连编译整体环境,都要耗费很大的精力. 我们的直播播放器,

[原创]java WEB学习笔记93:Hibernate学习之路---Hibernate 缓存介绍,缓存级别,使用二级缓存的情况,二级缓存的架构集合缓存,二级缓存的并发策略,实现步骤,集合缓存,查询缓存,时间戳缓存

本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱好者,互联网技术发烧友 微博:伊直都在0221 QQ:951226918 -----------------------------------------------------------------------------------------------------------------

当前凌晨时间戳

echo strtotime(date('Y-m-d')); 获取明天凌晨的时间戳代码:echo strtotime(date('Y-m-d',strtotime('+1 day'))); 附上测试代码:echo strtotime('2012-11-2');echo strtotime('2012-11-2 00:00:00');echo strtotime(date('Y-m-d')),'';echo date('Y-m-d H:i:s',strtotime(date('Y-m-d')));

MySQL时间戳和日期相互转化

1.UNIX_TIMESTAMP():将日期时间转换成时间戳 2.FROM_UNIXTIME():将时间戳转换成日期时间 实例: SELECT NOW(),UNIX_TIMESTAMP(NOW()),FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())); 版权声明:本文为博主原创文章,未经博主允许不得转载.

php日期和时间基础知识--Unix时间戳

<?php /*1.取得当前的Unix时间戳 UNIX 时间戳(英文叫做:timestamp)是 PHP 中关于时间与日期的一个很重要的概念,它表示从 1970年1月1日 00:00:00 到当前时间的秒数之和. PHP提供了内置函数 time() 来取得服务器当前时间的时间戳.那么获取当前的UNIX时间戳就很简单了. */ $timer = time(); echo $timer; /*2.取得当前的日期 php内置了date()函数,来取得当前的日期. 函数说明:date(时间戳的格式, 规

JS 时间字符串与时间戳之间的转换

1.当前时间换时间戳 var timestamp = parseInt(new Date().getTime()/1000); // 当前时间戳 document.write(timestamp); 2.当前时间换日期字符串 var now = new Date(); var yy = now.getFullYear(); //年 var mm = now.getMonth() + 1; //月 var dd = now.getDate(); //日 var hh = now.getHours(

在windows条件,Ping加上时间戳,并保存到文件

在windows条件,Ping加上时间戳,并保存到文件 转载:http://blog.csdn.net/byply/article/details/50628403 1.在D盘新建"ping.vbs"文件,输入如下代码: Dim args, flag, unsuccOut args="" otherout="" flag=0 If WScript.Arguments.count = 0 Then WScript.Echo "Usage:

时间戳 js 转换

// 获取当前时间戳(以s为单位) var timestamp = Date.parse(new Date()); timestamp = timestamp / 1000; //当前时间戳为:1403149534 console.log("当前时间戳为:" + timestamp); // 获取某个时间格式的时间戳 var stringTime = "2014-07-10 10:21:12"; var timestamp2 = Date.parse(new Dat