当前位置:网站首页>Conversion between VC string and timestamp
Conversion between VC string and timestamp
2022-07-24 19:35:00 【Yulong_】
The principle and code are very simple ( Better than those on the Internet time It is much more convenient for the structure to turn around ), I won't talk about it , Directly on the code :
#include <Windows.h>
#include <atlstr.h>
#include <ATLComTime.h>
#include <atltime.h>
int main()
{
// String to timestamp
CString strTime = "2022-07-18 19:30:22";
COleDateTime oletime;
__int64 instatime = 0;
if (oletime.ParseDateTime(strTime))
{
CTime ctime(oletime.GetYear(), oletime.GetMonth(), oletime.GetDay(), oletime.GetHour(), oletime.GetMinute(), oletime.GetSecond());
instatime = ctime.GetTime();
printf(" Time stamp :%ld\n",instatime);
}
// Timestamp to string
COleDateTime oletime2(instatime);
CString strDate = oletime2.Format(L"%Y-%m-%d %H:%M:%S");
printf(" Time :%S\n", strDate.GetBuffer());
system("pause");
return 0;
}
Program output :

边栏推荐
猜你喜欢

Biopharmaceutical safety, power supply and production guarantee

Unity2d~ game practice of decrypting Zhou mu (completed in three days)

Hucang integrated release of full data value, sequoiadb V5.2 online conference heavy attack

拿捏C指针

Meshlab&PCL ISS关键点

Literature reading: gopose 3D human pose estimation using WiFi

Flink Window&Time 原理

day 1

Convolutional neural network CNN
![[JVM learning 03] class loading and bytecode Technology](/img/b4/9482b02b58580171235fd4c36129e9.png)
[JVM learning 03] class loading and bytecode Technology
随机推荐
Unity框架之ConfigManager【Json配置文件读写】
从服务器批量下载文件到本地
Solutions to oom caused by pictures in res directory
MySQL (data types and integrity constraints)
湖仓一体释放全量数据价值,SequoiaDB v5.2线上发布会重磅来袭
2019 Hangdian multi school first 6581 vacation [thinking]
Analysis of the basic concept of digital warehouse
LSTM and Gru of RNN_ Attention mechanism
Unity2d~ game practice of decrypting Zhou mu (completed in three days)
Sword finger offer 52. The first common node of the two linked lists
Reading notes: you only look once:unified, real time object detection
【无标题】
Ensure the health and safety of front-line construction personnel, and implement wrong time construction at Shenzhen construction site
[laser principle and application -6]:q switching element and Q drive circuit board
MySQL version 5.7.9 SQL_ mode=only_ full_ group_ By question
Cesium uses czml to implement dynamic routes
[face to face experience of school recruitment] 8 real questions of pointer interview. Come and test how many you have mastered.
Modelarts, Pangu big model, ModelBox... Detailed explanation of Huawei cloud AI development production line
【校招面经】8道指针面试真题,快来检测自己掌握了几道。
[JVM learning 04] JMM memory model