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 ...
随机推荐
- 红米1S.线刷
ZC:遇到问题:“Missmatching image and device”,解决网址:“[2.23][史上最全]MiFlash线刷错误的那些事儿_收藏备用_小米手机4_MIUI论坛.html”(h ...
- linux--svn checkout
svn --username=yourname co svn_path local_path
- node——路由控制
路由控制 前面我接触了如何使用express建立一个工程,虽然这个工程包含了一些基本的框架,但是没有实际内容,我们会不断给他增加的. 工作原理 我们在浏览器中访问app.js建立的服务器时,会出现一个 ...
- cassandra cqlsh 和 python客户端
Keyspaces A cluster is a container for keyspaces. A keyspace is the outermost container for data in ...
- 利用wtl的CDialogResize自动调整atl ActiveX控件布局
前言 利用atl 开发activex控件时,如果使用atl复合控件时,acitvex控件上的界面元素不会自动改变大小,如果自己在OnSize中处理每个子控件的布局是一件非常麻烦的事,我们可以借助wtl ...
- 22 Python 模块与包
一 模块 1 什么是模块? 常见的场景:一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 但其实import加载的模块分为四个通用类别: 1 使用python编 ...
- LeetCode OJ:Subsets(子集)
Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must ...
- Project://Meeting_Room
models from django.db import models from django.contrib.auth.models import AbstractUser class UserIn ...
- 网络编程基础--多线程---concurrent.futures 模块---事件Event---信号量Semaphore---定时器Timer---死锁现象 递归锁----线程队列queue
1 concurrent.futures 模块: # from abc import abstractmethod,ABCMeta # # class A(metaclass=ABCMeta): # ...
- C# WebApi 配置复杂路由不生效的问题
配置复杂路由不生效是由于优先级的关系,应该把默认路由放在最后. config.Routes.MapHttpRoute( name: "DynamicApi", routeTempl ...