C++ UTC time to timestamp 转化
来源:互联网 发布:linux下mysql连接命令 编辑:程序博客网 时间:2024/05/05 23:53
void UTCtoTimeStamp(string& UTC)
{
struct tm t;
time_t t_of_day;
strptime(UTC.c_str(), "%a %b %d %H:%M:%S %Z %Y", &t);
t_of_day = mktime(&t);
//printf("seconds since the Epoch: %ld\n", (long) t_of_day);
stringstream ostr("");
ostr<<t_of_day;
UTC=ostr.str();
}
{
struct tm t;
time_t t_of_day;
strptime(UTC.c_str(), "%a %b %d %H:%M:%S %Z %Y", &t);
t_of_day = mktime(&t);
//printf("seconds since the Epoch: %ld\n", (long) t_of_day);
stringstream ostr("");
ostr<<t_of_day;
UTC=ostr.str();
}
转换控制符说明
%a星期几的简写形式
%A星期几的全称
%b月份的简写形式
%B月份的全称
%c日期和时间
%d月份中的日期,0-31
%H小时,00-23
%I12进制小时钟点,01-12
%j年份中的日期,001-366
%m年份中的月份,01-12
%M分,00-59
%p上午或下午
%s秒,00-60
%u星期几,1-7
%w星期几,0-6
%x当地格式的日期
%X当地格式的时间
%y年份中的最后两位数,00-99
%Y年
%Z地理时区名称
0 0
- C++ UTC time to timestamp 转化
- Python: Convert UTC time-tuple to UTC timestamp
- C local time & UTC time
- GPSTime To UTC Date Time
- how to convert UTC to local time
- UTC Time
- CRM 2011 Online SSRS report UTC time to local time
- convert utc time to local time in excel
- UTC、GMT、Unix Time、Unix epoch、POSIX time、Unix timestamp以及本机时间转换 问题
- java convert timestamp to date and time
- UTC Time->Local Time
- [android] UTC Time
- Python utc转化时间
- INTERVAL YEAR TO MONTH和TIMESTAMP WITH TIME ZONE 等
- python time 字符串转UTC
- Difference between Unix Time and UTC time
- Azure Website - UTC Time and Local Time
- UTC to CET
- 预处理与宏定义
- JAVA 操作xml的方法
- WCF 学习
- 解决yum报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify
- Xcode编译工程时出现Unknown type name 'NSString' 错误
- C++ UTC time to timestamp 转化
- android显示开机动画的延时时间内时加载activity
- centOS中的配置文件,触摸板设置,写脚本
- Access Class Barring
- 一次使用Eclipse Memory Analyzer分析Tomcat内存溢出
- Android 和php交互及图片上传功能
- iOS清除缓存
- Spring MVC+mybatis 环境搭建,总结
- tableViewCell 被选中时候的背景自定义和文字高亮颜色