推扬网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
推扬网 门户 你问我答 查看内容

陈金才:13位时间戳怎么转换成标准时间【易语言】

2020-8-12 16:22| 发布者: admin| 查看: 166| 评论: 0

摘要: 庞威的回答: 使用范例 char *str="1320718222932"; long long time1; sscanf(str,"%I64d",&time); CString strTime=MillSecond2LocalTime(time,8); /////////////////////////////////////////////////// ...

庞威的回答:

使用范例 char *str="1320718222932"; long long time1; sscanf(str,"%I64d",&time); CString strTime=MillSecond2LocalTime(time,8); ///////////////////////////////////////////////////////////////////////////// int CTimeChangeDlg::IsLeap(unsigned short year) { return ((year%4==0)&&(year%100!=0)||(year%400==0)); } CString CTimeChangeDlg::MillSecond2LocalTime(long long time,long timezone) { const int monthLengths[2][13]={ {0,31,59,90,120,151,181,212,243,273,304,334,365 }, {0,31,60,91,121,152,182,213,244,274,305,335,366 } }; const int yearLengths[2]={365,366}; int year(0),month(0),minMonth(0),maxMonth(0),days(0),clock(0),isLeap(0),day(0),hour(0),minute(0),second(0); time/=1000; time+=timezone*60*60; days=time/86400;//天数 clock=time%86400;//小时数 if(clock<0) { clock+=86400; days-=1; } if(days>=0) { year=days/366; days-=year*365+(year+1)/4-(year+69)/100+(year+369)/400; for (year=year+1970;;year++) { isLeap=IsLeap(year); if(days=0) { break; } } } minMonth=0; maxMonth=12; for (month=5;month<12&&month>0;month=(minMonth+maxMonth)/2) { if (days=monthLengths[isLeap][month+1]) { minMonth=month; } else { break; } } days-=monthLengths[isLeap][month]; month++; day=days+1; hour=clock/3600; clock=clock%3600; minute=clock/60; second=clock%60; CString t; t.Format(TEXT("%d-%02d-%02d %02d:%02d:%02d"),year,month,day,hour,minute,second); return t; }

黄文仔的回答:

使用范例 char *str="1320718222932"; long long time1; sscanf(str,"%I64d",&time); CString strTime=MillSecond2LocalTime(time,8); ///////////////////////////////////////////////////////////////////////////// int CTimeChangeDlg::IsLeap(unsigned short year) { return ((year%4==0)&&(year%100!=0)||(year%400==0)); } CString CTimeChangeDlg::MillSecond2LocalTime(long long time,long timezone) { const int monthLengths[2][13]={ {0,31,59,90,120,151,181,212,243,273,304,334,365 }, {0,31,60,91,121,152,182,213,244,274,305,335,366 } }; const int yearLengths[2]={365,366}; int year(0),month(0),minMonth(0),maxMonth(0),days(0),clock(0),isLeap(0),day(0),hour(0),minute(0),second(0); time/=1000; time+=timezone*60*60; days=time/86400;//天数 clock=time%86400;//小时数 if(clock<0) { clock+=86400; days-=1; } if(days>=0) { year=days/366; days-=year*365+(year+1)/4-(year+69)/100+(year+369)/400; for (year=year+1970;;year++) { isLeap=IsLeap(year); if(days=0) { break; } } } minMonth=0; maxMonth=12; for (month=5;month<12&&month>0;month=(minMonth+maxMonth)/2) { if (days=monthLengths[isLeap][month+1]) { minMonth=month; } else { break; } } days-=monthLengths[isLeap][month]; month++; day=days+1; hour=clock/3600; clock=clock%3600; minute=clock/60; second=clock%60; CString t; t.Format(TEXT("%d-%02d-%02d %02d:%02d:%02d"),year,month,day,hour,minute,second); return t; }

baby↓卟漓的回答:

看格式应该是php输出的时间戳 应该是随机英文 或者是 密钥之类的 检查下post 数据和cookies


鲜花

握手

雷人

路过

鸡蛋

最新评论

热门推荐
最新资讯

广告服务|投稿要求|禁言标准|版权说明|免责声明|手机版|小黑屋|推扬网 ( 粤ICP备18134897号 )|网站地图 | 邮箱:vayae@hotmail.com

GMT+8, 2025-5-2 03:24 , Processed in 0.061885 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

返回顶部