学习备忘--获取当前日期时间(精确到毫秒)
2012-08-07 17:43
330 查看
#include #include #include #include using namespace std; typedef char * PCHAR; void Now(PCHAR buff); int main() { char buff[128]; Now(buff); cout << buff << endl; return 0; } void Now(PCHAR buff) { struct timeb tp; struct tm *tm; ftime(&tp); tm = localtime(&tp.time); sprintf(buff, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d.%.3d", 1900+ tm->tm_year, 1 + tm->tm_mon, tm->tm_yday, tm->tm_hour, tm->tm_min, tm->tm_sec, tp.millitm); }
欢迎加入我们的QQ群,无论你是否工作,学生,只要有c / vc / c++ 编程经验,就来吧!158427611
相关文章推荐
- 如何获取精确到毫秒的当前时间以及 日期与时间的相互转化
- 如何获取精确到毫秒的当前时间以及 日期与时间的相互转化
- linux C++ 获取当前时间,以标准时间“年-月-日 时:分:秒”的形式输出,且秒后边跟小数精确到毫秒
- Linux 下c获取当前时间(精确到秒和毫秒或者微秒)
- java获取当前时间精确到毫秒
- 获取当前系统本地时间,精确到毫秒的实例
- Linux 下c获取当前时间(精确到秒和毫秒或者微秒)
- java获取当前时间精确到毫秒
- 获取时间/日期工具类:格式化日期,获取当前时间,指定时间,上一月,指定时间的毫秒数
- 【C#学习笔记】C#获取当前日期时间
- Linux获取系统当前时间(精确到毫秒)
- java获取当前时间精确到毫秒
- VB.NET获取系统当前精确时间(毫秒级)
- linux下获取当前时间(精确到毫秒)
- Linux获取系统当前时间(精确到毫秒)
- Linux获取系统当前时间(精确到毫秒)
- Linux 下c获取当前时间(精确到秒和毫秒或者微秒)
- Linux获取系统当前时间(精确到毫秒)
- Linux 下c获取当前时间戳(精确到秒和毫秒或者微秒或者纳秒)
- Linux获取系统当前时间(精确到毫秒)