Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl:如何将毫秒转换为时间戳或日期_Perl_Date - Fatal编程技术网

Perl:如何将毫秒转换为时间戳或日期

Perl:如何将毫秒转换为时间戳或日期,perl,date,Perl,Date,我需要将时间(毫秒)转换为格式为:YYYY-mm-dd hh:mm:ss的日期 请帮助“毫秒”不表示时间,它们表示持续时间。听起来好像有一个unix历元时间戳乘以1000,再加上毫秒 use POSIX qw( strftime ); my $formatted = strftime("%Y-%m-%d %H:%M:%S", localtime($ts/1000)); 或者gmtime从何时开始的毫秒?重复?相应地更新了我的答案

我需要将时间(毫秒)转换为格式为:YYYY-mm-dd hh:mm:ss的日期 请帮助

“毫秒”不表示时间,它们表示持续时间。听起来好像有一个unix历元时间戳乘以1000,再加上毫秒

use POSIX qw( strftime );
my $formatted = strftime("%Y-%m-%d %H:%M:%S", localtime($ts/1000));

或者
gmtime

从何时开始的毫秒?重复?相应地更新了我的答案