格林威治时间
来源:互联网 发布:蓝博清单计价软件 编辑:程序博客网 时间:2024/04/28 14:21
格林威治时间:格林威治是英国伦敦南郊原格林威治天文台的所在地,它又是世界上地理度的起始点。
对于世界上发生的重大事件,都以格林威治的地方时间记录下来。一旦知道了格林威治
时间,人们就很容易推算出相当的本地时间。
将日历时间转换为格林威治标准时间:
头文件 : #include<time.h>
函数原型:struct tm *gmtime(const time_t *timep);
strcut tm *gmtime(const time_t *timep,char buf);
函数功能:将日历时间转换为格林威治标准时间;
参 数:日历时间的返回值;
返 回 值 :指向 strcut tm 结构体指针
范 例:
#include <stdio.h>
#include<time.h>
int main()
{
time_t t;
struct tm gtm;
gtm =gmtime(&t);
printf("gmt->year =%d \n",gmt->tm_year); //年
printf("gmt->month =%d \n",gmt->tm_mon); //月
printf("gmt->day =%d \n",gmt->tm_yday); //日(按年)
printf("gmt->weedday =%d \n",gmt->tm_wday); //星期
printf("gmt->hour =%d \n",gmt->tm_hour); //小时
printf("gmt->min =%d \n",gmt->tm_min); //分钟
printf("gmt->second =%d \n",gmt->tm_sec); //分钟
return 0;
}
附录:
struct tm {
int tm_sec; /* 秒 – 取值区间为[0,59] */
int tm_min; /* 分 - 取值区间为[0,59] */
int tm_hour; /* 时 - 取值区间为[0,23] */
int tm_mday; /* 一个月中的日期 - 取值区间为[1,31] */
int tm_mon; /* 月份(从一月开始,0代表一月) - 取值区间为[0,11] */
int tm_year; /* 年份,其值等于实际年份减去1900 */
int tm_wday; /* 星期 – 取值区间为[0,6],其中0代表星期天,1代表星期
一,以此类推 */
int tm_yday; /* 从每年的1月1日开始的天数 – 取值区间为[0,365],其中
0代表1月1日,1代表1月2日,以此类推 */
int tm_isdst; /* 夏令时标识符,实行夏令时的时候,tm_isdst为正。不实行
夏令时的进候,tm_isdst为0;不了解情况时tm_isdst()
为负。*/
}
阅读全文
0 0
- 格林威治时间
- 时间 格林威治时间
- 获取格林威治时间
- 格林威治时间转换成北京时间
- PHP格林威治时间相关函数
- JAVA时间转为格林威治时间
- 获取当前格林威治时间
- java格式化格林威治时间
- 美国洛杉矶时间转 格林威治时间
- js格式化格林威治时间
- 格林威治时间如何转为系统时间?
- 将格林威治时间转换为北京时间
- Java相对格林威治时间的计算
- js 时间格式转换 格林威治时间
- windows更改没人格林威治时间命令
- 时间编程--获取格林威治时间 gmtime
- 已知格林威治时间怎么转北京时间?
- 将格林威治时间转换为字符串
- undefined reference to `vtable for __cxxabiv1:
- mybatis关系映射之一对多和多对一
- Tomcat上进行项目部署与WAR包含义
- JMS学习一(JMS介绍)
- VBA中的数据字典,可以理解为Java中的Map
- 格林威治时间
- 菱形继承
- 欢迎使用CSDN-markdown编辑器
- hadoop 2.8.1 windows7 搭建过程
- Leetcode 395. Longest Substring with At Least K Repeating Characters
- 线程池
- 【poj2387】Til the Cows Come Home 【USACO 2004 November】
- linux常用命令二
- 【NOIP2012提高组】同余方程 (扩展欧几里得算法)