获取毫秒时间格式YYYYMMDD:HH:MM:SS:MS [英] Get time format with milli seconds YYYYMMDD:HH:MM:SS:MS

查看:1471
本文介绍了获取毫秒时间格式YYYYMMDD:HH:MM:SS:MS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,

任何人都可以使用任何功能来转换给定的纪元时间,使用当地时间格式转换为Milli Seconds。



谢谢

Sharan



我的尝试:



下面是我试过的那个:

Hi Team,
Can anyone help with any function to convert the given epoch time to convert with local time format with Milli Seconds.

Thanks
Sharan

What I have tried:

Below is the one I tried:

double epochStr = 1478612819065
    static char timestamp[64] = "";
    time_t tt = 0;
    memset(timestamp, '\0', 64);
    tt = epochStr;
    strftime(timestamp, 64, "%Y-%m-%d:%H:%M:%S", localtime(&tt));
    cout <<timestamp<<'\n';

推荐答案

你无法从纪元时间因为其粒度为 1 秒(请参阅 Unix时间 - 维基百科 [ ^ ])。
You cannot extract milliseconds from Epoch time since its granularity is 1 second (see Unix time - Wikipedia[^]).


这篇关于获取毫秒时间格式YYYYMMDD:HH:MM:SS:MS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆