当前位置:网站首页>Two ways to realize time format printing
Two ways to realize time format printing
2022-06-26 08:28:00 【Tonyfield】
utilize Time function to realize time format printing
#include <time.h>
#include <ctype.h>
time_t rawtime;
struct tm timeinfo;
TCHAR szTime[100];
time ( &rawtime );
localtime_s ( &timeinfo, &rawtime );
_tcsftime( szTime,ARRAYSIZE(szTime), _T("%a %Y-%m-%d %X"), &timeinfo);Time format printing is realized by using traditional string printing function
#include <time.h>
#include <ctype.h>
time_t rawtime;
struct tm timeinfo;
TCHAR szTime[100];
time ( &rawtime );
localtime_s ( &timeinfo, &rawtime );
sprintf_s(szTime,ARRAYSIZE(szTime),
"%4d-%02d-%02d %02d:%02d:%02d",
1900+timeinfo.tm_year,
1+timeinfo.tm_mon,
timeinfo.tm_mday,
timeinfo.tm_hour,
timeinfo.tm_min,
timeinfo.tm_sec);
边栏推荐
- Undefined symbols for architecture i386与第三方编译的静态库有关
- Pychart connects to Damon database
- And are two numbers of S
- Design of reverse five times voltage amplifier circuit
- Solve the problem that pychar's terminal cannot enter the venv environment
- RF filter
- Use of jupyter notebook
- Interview ES6
- How to Use Instruments in Xcode
- Calculation of decoupling capacitance
猜你喜欢

Analysis of internal circuit of operational amplifier

Can the encrypted JS code and variable name be cracked and restored?

Reflection example of ads2020 simulation signal

(5) Matrix key

Jupyter的安装

鲸会务为活动现场提供数字化升级方案

Opencv learning notes 3

Read excel table and render with FileReader object

MySQL practice: 4 Operation of data

STM32 project design: temperature, humidity and air quality alarm, sharing source code and PCB
随机推荐
leetcode2022年度刷题分类型总结(十二)并查集
JWT in go
CodeBlocks集成Objective-C开发
[已解决]setOnNavigationItemSelectedListener()被弃用
(1) Turn on the LED
软件工程-个人作业-提问回顾与个人总结
51 MCU project design: Based on 51 MCU clock perpetual calendar
(4) Independent key
Quickly upload data sets and other files to Google colab ------ solve the problem of slow uploading colab files
Delete dictionary from list
2020-10-29
SOC的多核启动流程详解
Microcontroller from entry to advanced
Idea automatically sets author information and date
When loading view, everything behind is shielded
[untitled]
GHUnit: Unit Testing Objective-C for the iPhone
Opencv learning notes 3
[postgraduate entrance examination planning group] conversion between signed and unsigned numbers
Pychart connects to Damon database