#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<iostream>
#include<vector>
#include <string>
#include <fstream>
#include <string>
#include<ctime>
using namespace std;
int main()
{
string filename="C:\\Users\\Dell\\Desktop\\TS\\Sub_data.txt";//在此处输入读取文件的路径
int start_year,start_month,start_day,start_hour,start_min,start_sec;
int end_year,end_month,end_day,end_hour,end_min,end_sec;
/////输入截取时间
//开始时间 ////此处需要初始化开始时间和截止时间
start_year=2007;
start_month=1;
start_day=20;
start_hour=7;
start_min=0;
start_sec=0;
//截止时间
end_year=2007;
end_month=1;
end_day=20;
end_hour=12;
end_min=0;
end_sec=0;
printf("start time:%d-%d-%d-%d-%d-%d\n",start_year,start_month,start_day,start_hour,start_min,start_sec);
printf("end time:%d-%d-%d-%d-%d-%d\n",end_year,end_month,end_day,end_hour,end_min,end_sec);
//输入截取的时间
//将格林威治时间转换为日历时间
struct tm t_start;
struct tm t_end;
time_t t_start_of_day;//开始日历时间
time_t t_end_of_day;//终止日历时间
t_start.tm_year=start_year-1900;
t_start.tm_mon=start_month-1;
t_start.tm_mday=start_day;
t_start.tm_hour=start_hour;
t_start.tm_min=start_min;
t_start.tm_sec=start_sec;
t_end.tm_year=end_year-1900;
t_end.tm_mon=end_month-1;
t_end.tm_mday=end_day;
t_end.tm_hour=end_hour;
t_end.tm_min=end_min;
t_end.tm_sec=end_sec;
t_start_of_day=mktime(&t_start);
t_end_of_day=mktime(&t_end);
printf("start calander time is: %d\n", t_start_of_day);
printf("end calander time is: %d\n", t_end_of_day);
}
日历时间转换为格林威治时间,格林威治时间转换为日历时间
需积分: 46 72 浏览量
2017-07-26
14:03:35
上传
评论
收藏 1KB ZIP 举报
zxf0827
- 粉丝: 0
- 资源: 2
最新资源
- delphi实现DBGrid全选和反选功能
- 25C11F41-2B2A-4D1A-AAA8-7C654526B129.pdf
- Android Studio Jellyfish(android-studio-2023.3.1.18-cros.deb)
- MVC+EF框架+EasyUI实现权限管理源码程序
- python第66-75天,Day66-75.rar
- python后端服务project-of-tornado.rar
- python测验,hello-tornado.rar
- 基于SpringBoot+Vue3快速开发平台、自研工作流引擎源码设计.zip
- docker安装部署全流程
- 基于树莓派的人脸识别系统python源码+项目部署说明+超详细代码注释.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈