博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ctime函数--把日期和时间转换为字符串(打印时间时常用-LINUX系统)
阅读量:4166 次
发布时间:2019-05-26

本文共 263 字,大约阅读时间需要 1 分钟。

函数: ctime
功 能: 把 和时间转换为字符串
用 法: char *ctime(const time_t *time);
程序例:
1
2
3
4
5
6
7
8
9
#include<cstdio>
#include<ctime>
int 
main(
void
)
{
time_t 
t;
t=
time
(&t);
printf
(
"Today'sdateandtime:%s\n"
,
ctime
(&t));
return 
0;
}
注:若在linux下使用本函数,需要include <time.h>头文件

转载地址:http://ezexi.baihongyu.com/

你可能感兴趣的文章
RESTFUL风格的接口
查看>>
后台参数验证配置
查看>>
SpringBoot之外置Tomcat配置
查看>>
java 删除 list 中的元素
查看>>
idea启动优化
查看>>
java发展史
查看>>
Java内存区域
查看>>
数据库与模式的区别
查看>>
数字签名的原理
查看>>
showDialog
查看>>
Flex 拖拽范例
查看>>
flash builder 4 编译器参数
查看>>
flex常用网站
查看>>
flex 页面跳转
查看>>
cat | wc -l 少一行的问题
查看>>
socket 科普文章
查看>>
Mutex, semaphore, spinlock的深度解析
查看>>
pthread线程使用小结
查看>>
A Game of Thrones(59)
查看>>
2018.3.19
查看>>