`

What is epoch time?

阅读更多

unix 时间转换器


The  Unix epoch   (or  Unix time   or  POSIX time   or  Unix timestamp ) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1-1-1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038). 

Human readable time   Seconds
1 minute 60 seconds
1 hour 3600 seconds
1 day 86400 seconds
1 week 604800 seconds
1 month (30.44 days)  2629743 seconds
1 year (365.24 days)   31556926 seconds
 

 How to get the current epoch time in ...

Perl time
PHP time()
Ruby Time.now   (or  Time.new ). To display the epoch:  Time.now.to_i
Python import time   first, then  time.time()
Java long epoch = System.currentTimeMillis()/1000;
Microsoft .NET C# epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
VBScript/ASP DateDiff("s", "01/01/1970 00:00:00", Now())
Erlang calendar:datetime_to_gregorian_seconds(calendar:now_to_universal_time( now()))-719528*24*3600.
MySQL SELECT unix_timestamp(now())   More information
PostgreSQL SELECT extract(epoch FROM now());
Oracle PL/SQL SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) * 
24 * 60 * 60 FROM DUAL
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
JavaScript Math.round(new Date().getTime()/1000.0)   getTime() returns time in milliseconds.
Unix/Linux date +%s
Other OS's Command line:  perl -e "print time"   (If Perl is installed on your system)

 Convert from human readable date to epoch

Perl Use these  Perl Epoch routines
PHP mktime(hour ,  minute ,  second ,  month ,  day ,  year )   More information
Ruby Time.local(year ,  month ,  day ,  hour ,  minute ,  second ,  usec   )   (or  Time.gm   for GMT/UTC input). To display add  .to_i
Python import time   first, then  int(time.mktime(time.strptime('2000-01-01 12:34:00', '%Y-%m-%d %H:%M:%S'))) - time.timezone
Java long epoch = new java.text.SimpleDateFormat ("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");
VBScript/ASP DateDiff("s", "01/01/1970 00:00:00",  time field )   More information
MySQL SELECT unix_timestamp(time )   Time format: YYYY-MM-DD HH:MM:SS or YYMMDD or YYYYMMDD
More on using Epoch timestamps with MySQL
PostgreSQL SELECT extract(epoch FROM date('2000-01-01 12:34'));
With timestamp:  SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08');
With interval:  SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00',  time field )
JavaScript use the  JavaScript Date object
Unix/Linux date +%s -d"Jan 1, 1980 00:00:01"   Replace '-d' with '-ud' to input in GMT/UTC time.

 Convert from epoch to human readable date

Perl Use these  Perl Epoch routines
PHP date(output format ,  epoch );   Output format example: 'r' = RFC 2822 date  More information
Ruby Time.at(epoch )
Python import time   first, then  time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(epoch ))   Replace time.localtime with time.gmtime for GMT time.  More information
Java String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date (epoch *1000));
VBScript/ASP DateAdd("s",  epoch , "01/01/1970 00:00:00")   More information
PostgreSQL SELECT TIMESTAMP WITH TIME ZONE 'epoch' +  epoch   * INTERVAL '1 second';
MySQL from_unixtime(epoch ,  optional output format )   The default output format is YYY-MM-DD HH:MM:SS  more ...
SQL Server DATEADD(s,  epoch , '1970-01-01 00:00:00')
Microsoft Excel =(A1 / 86400) + 25569   Format the result cell for date/time, the result will be in GMT time (A1 is the cell with the epoch number). For other timezones: =((A1 +/- timezone adjustment) / 86400) + 25569.
JavaScript use the  JavaScript Date object
Unix/Linux date -d @1190000000   Replace 1190000000 with your epoch, needs recent version of 'date'. Replace '-d' with '-ud' for GMT/UTC time.
Other OS's Command line:  perl -e "print scalar(localtime(epoch ))"   (If Perl is installed) Replace 'localtime' with 'gmtime' for GMT/UTC time.

分享到:
评论

相关推荐

    Epoch GisServer User Guide

    Epoch GisServer User Guide

    EPOCH安装教程(官方提供)

    EPOCH安装教程(官方提供) 按照pdf上的方法一步一步组装EPOCH

    epoch_user-4.17_粒子模拟说明文档_

    三维粒子模拟程序的说明文档,可以模拟等立体的状态灯等。

    DayZ-Epoch, 用于 Arma 2的实验 DayZ.zip

    DayZ-Epoch, 用于 Arma 2的实验 DayZ DayZ实验 DayZ modhttp://dayzepoch.com基于DayZ的社区版https://github.com/DayZMod/DayZ/blob/1.8.8/Documentation/Credits.md ht

    jQuery可视化图表库插件Epoch

    Epoch是一个通用图表库为应用程序开发人员和设计师提供可视化界面。它关注可视化编程的两个不同的方面:基本图表创建历史报告,实时图表显示数据。要求浏览器ie8以上

    BBN.iNaturalist2017.res50.180epoch.best_model.pth

    预训练模型 BBN.iNaturalist2017.res50.180epoch.best_model.pth

    epoch_5000.pth

    随着我国超高压电力线的大规模建设,输电线路的巡查已变得至关重要,这是确保电力系统中电能可靠传输的重要举措。中国幅员辽阔,气候困难多变,电力线走廊经常穿越高空积雪和冰雪覆盖的地区,传统的人工动力检查由于...

    yolov8 人脸检测数据集 一万张照片,300 epoch训练好的模型best.pt文件

    yolov8 人脸检测数据集 一万张照片,300 epoch训练好的模型best.pt文件 准确率能达到百分之八十以上 预训练模型使用yolov8s, gpu3080ti训练两天

    EPOCH 600 Remote Commands v3.0

    Olympus epoch 600 远程指令

    javascript图表库Epoch.zip

    Epoch 是一个通用的实时的图表库,用于构建漂亮、平滑和高性能的可视化图形图表。Epoch 提供多种基本图表和专业图表。Epoch 依赖于 jQuery 和 D3。使用: 标签:Epoch

    train_model_epoch_10_2019_01_16-4.meta

    我自己训练的模型,多层感知器训练后将所提取的样本对中的非线性映射关系存储在权值矩阵中 ,在其 后的工作阶段 ,当向网络输入训练时未曾见过的非样本数据时 ,网络也能完成由输入空间 向输出空间的正确映射 。...

    TIME (1).pdf

    返回⾃纪元Epoch(1970-01- ⼀、C语⾔的时间处理库 1.time 2 01 00:00:00 UTC)起经过的时间秒数,UTC时间也即是格林尼治标准时间 GMT(世界协调时间)。 如果参数timer是⼀个空指针,函数会返回⼀个time_t的⻓整形。...

    Python中生成Epoch的方法

    在Python2中datetime对象没有timestamp方法,不能很方便的生成epoch,现有方法没有处理很容易导致错误。关于Epoch可以参见时区与Epoch 0 Python中生成Epoch from datetime import datetime # python3 datetime.now...

    RTMPOSE S EAR 自训练 300 epoch

    RTMPOSE S EAR 自训练 300 epoch

    rtmdet tiny ear 自训练200 epoch

    rtmdet tiny ear 自训练200 epoch

    Batch, Epoch, Iteration, Sample的区别

    40批走完为1个epoch,此时全部训练集参与完成了一次完整训练 训练一共进行1000个epoch 参数 样本数(Sample):200 批次大小(BatchSize):5 批次数(Iteration):40 代数(Epoch):1000 程序结构 for epoch = 1 ...

    Epoch200-Total_Loss2.0690-Val_Loss2.3955.pth

    使用6000张数据集训练了200代的火焰烟雾识别权重,loss值已经降到2左右了,亲自测试可以使用,正确率达到90%

    Packt_Neural_Networks_with_R

    What is machine learning? Supervised learning Unsupervised learning Reinforcement learning Training and testing the model The data cycle Evaluation metrics Confusion matrix True Positive Rate True ...

    cpm_vgg16-epoch-049-050.pth

    facebookresearch的supervision-by-registration项目所需的pytorch模型文件。

    SDFResults.jl:读取和分析EPOCH仿真数据

    快速开始使用以下方法安装软件包]add SDFResults假设您有一个包含从EPOCH模拟生成的.sdf文件的文件夹,请使用read_simulation读取模拟的元数据。 您可以索引到生成的对象并访问各个仿真文件。 请注意,默认情况下,...

Global site tag (gtag.js) - Google Analytics