C获取当前时间
#include <stdio.h>
#include <time.h>
#include <string>
#include <windows.h>
using namespace std; void main()
{
//精确到秒
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime ); char imgeName[] = {};
sprintf(imgeName,
"当前时间:%4d%02d%02d%02d%02d%02d",
+timeinfo->tm_year,
+timeinfo->tm_mon,
timeinfo->tm_mday,
timeinfo->tm_hour,
timeinfo->tm_min,
timeinfo->tm_sec); //imgeName = 0x00d4f908 "当前时间:20150804164416" //精确到毫秒
SYSTEMTIME currentTime;
GetSystemTime(¤tTime);
printf("time: %u/%u/%u %u:%u:%u:%u %d\n",
currentTime.wYear,currentTime.wMonth,currentTime.wDay,
currentTime.wHour,currentTime.wMinute,currentTime.wSecond,
currentTime.wMilliseconds,currentTime.wDayOfWeek); /*
wYear 2015 unsigned short
wMonth 8 unsigned short
wDayOfWeek 2 unsigned short
wDay 4 unsigned short
wHour 9 unsigned short
wMinute 31 unsigned short
wSecond 33 unsigned short
wMilliseconds 149 unsigned short
*/ exit(); }
参考:http://zhidao.baidu.com/link?url=NhiAk1VJdL0X6abaisbuvFy7BmuaWLwp4-TedKdGp045XqXKWIMKnpukvyxsK4DxORdzHkoU_y_iHxQP3GD5-q
http://blog.csdn.net/witxjp/article/details/8079751
C获取当前时间的更多相关文章
- iOS中获取当前时间,设定时间,并算出差值
NSDate *date = [NSDate date];//获取当前时间 NSTimeZone *zone = [NSTimeZone systemTimeZone];//修改时区 NSIntege ...
- Js获取当前日期时间及其它操作
Js获取当前日期时间及其它操作var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份 ...
- 【转】Js获取当前日期时间及格式化操作
(转自:http://www.cnblogs.com/qinpengming/archive/2012/12/03/2800002.html) var myDate = new Date(); myD ...
- PHP 获取中国时间,即上海时区时间
/** * 获取中国时间,即上海时区时间 * @param <type> $format * @return <type> */ function getChinaTime($ ...
- C#获取北京时间与设置系统时间
获取北京时间 public static DateTime GetBeijingTime() { DateTime dt; // 返回国际标准时间 // 只使用 timeServers 的 IP 地址 ...
- jquery 获取日期时间
获取JavaScript 的时间使用内置的Date函数完成 var mydate = new Date();mydate.getYear(); //获取当前年份(2位)mydate.getFullYe ...
- 使用 jquery 获取当前时间的方法
我们在写一些效果时,经常要用到 jquery 获取当前时间,但是jquery 目前并没有提供直接获取当前时间的 api 或者函数,所以我们还是得用原生的 javascript 时间对象 Date 来获 ...
- java学习第13天( java获取当前时间,有关大数据的运算及精确数字运算,Date类)
一 java获取当前时间 学习一个函数,得到当前时间的准确值 System.currectTimeMillis(). 可以得到以毫秒为单位的当前时间.它主要用于计算程序运行时间,long start= ...
- js获取当前时间显示在页面上
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- Android获取系统时间方法的总结
Android获取系统时间方法的方法有很多种,常用的有Calendar.Date.currentTimeMills等方法. (1)Calendar Calendar获取系统时间首先要用Calendar ...
随机推荐
- (转)OpenStack Kilo 版本中 Neutron 的新变化
OpenStack Kilo 版本,OpenStack 这个开源项目的第11个版本,已经于2015年4月正式发布了.现在是个合适的时间来看看这个版本中Neutron到底发生了哪些变化了,以及引入了哪些 ...
- Nova中的系统状态分析
系统状态 作者 孔令贤 Nova提供这么几个资源状态的查询. Service Nova中的service有两类,一类是所谓的control service,一类就是compute service.要想 ...
- DataGrid的组成论述(WPF)
DataGrid:它标示是一个整体概念,是个大容器,包含Row的感念 Column:是表格的组成成分(表格是由列组成的),它包括Header和Cell的概念
- android:descendantFocusability用法简析(转)
开发中很常见的一个问题,项目中的listview不仅仅是简单的文字,常常需要自己定义listview,自己的Adapter去继承BaseAdapter,在adapter中按照需求进行编写,问题 ...
- Spring_总结_04_高级配置(二)_条件注解@Conditional
一.前言 本文承接上一节:Spring_总结_04_高级配置(一)之Profile 在上一节,我们了解到 Profile 为不同环境下使用不同的配置提供了支持,那么Profile到底是如何实现的呢?其 ...
- yeomen/bower/grunt
yeomen: npm install yo angular-in-action project npm install -g generator-angular npm install -g gen ...
- Linux-压缩与解压缩命令
常用的压缩格式:.zip .gz .bz2 .tar.gz .tar.bz2 1.Zip 压缩文件:zip 压缩文件名 源文件 压缩目录:zip -r 压缩文件名 源文件 解压缩.z ...
- python二分查找模块bisect
bisect模块用于二分查找,非常方便. Bisect模块提供的函数有: 1.查找 bisect.bisect_left(a,x, lo=0, hi=len(a)) : 查找在有序列表a中插入x的in ...
- 1.mysql优化---优化入门之MySQL的优化介绍及执行步骤
优化到底优化什么? 优化,一直是面试最常问的一个问题.因为从优化的角度,优化的思路,完全可以看出一个人的技术积累.那么,关于系统优化,假设这么个场景,用户反映系统太卡(其实就是高并发),那么 ...
- tensorflow 学习笔记-1
http://www.jianshu.com/p/e112012a4b2d 参考的网站 -------------------------------------------------------- ...