当前位置:网站首页>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 :

边栏推荐
- day 1
- Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]
- Calendar common methods
- Use of paging assistant PageHelper
- Siyuan notes V2.1.2 synchronization problem
- How to convert the world coordinates of unity's camera into view matrix
- Sword finger offer 46. translate numbers into strings
- Taokeeper environment setup
- Install SSL Certificate in Litespeed web server
- Solve the problem of disconnection due to long idle time after SSH login
猜你喜欢

Create a life cycle aware MVP architecture
思源笔记 v2.1.2 同步问题

原反补及大小端

Tencent Browser service TBS usage
![Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]](/img/77/28e8f826c7ee93fedada405c70b82b.png)
Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]

Day 10 (inheritance, rewriting and use of super)

Pay close attention! List of the latest agenda of 2022 open atom open source Summit

Hidden Markov model HMM

Machine learning_ Softmax function (multi classification problem)

Original reverse compensation and size end
随机推荐
Cmake series tutorial 2 HelloWorld
Flink window & time principle
02 | 环境准备:如何在windows下安装和配置一个基本的php开发环境?
拿捏C指针
聊下自己转型测试开发的历程
About the largeheap attribute
Colon sorting code implementation
Day 5 (array)
Analysis of the basic concept of digital warehouse
Day 9 (this keyword and experiment)
Sword finger offer 45. arrange the array into the smallest number
day 1
The ark compiler is coming. What about APK reinforcement
[in depth study of 4g/5g/6g topic -39]: urllc-10 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -3- how to distinguish urllc services? Detailed expl
JS part
Description of large and small end mode
Tencent Browser service TBS usage
Unity框架之ConfigManager【Json配置文件读写】
原反补及大小端
How to select the shelling tool?