简体   繁体   English

如何在C ++中将CString转换为CTime?

[英]How to convert CString to CTime in c++?

I want to use system's date/time which is in mm/dd/yy format in code. 我想在代码中使用mm / dd / yy格式的系统日期/时间。 But the problem is that the time that I am getting is not in ate/time format. 但是问题是我得到的时间不是按时间/时间格式。 So I want to change it to CTime format so that I can use it. 所以我想将其更改为CTime格式,以便可以使用它。 How is this going to be possible? 这怎么可能? How can I convert the CString into CTIme format? 如何将CString转换为CTIme格式?

Regards, 问候,

Mohan 莫汉

The sample for your issue is as follows: 您的问题的样本如下:

   COleDateTime myDtTime;
   CTime sysTime;
   if(myDtTime.ParseDateTime(strTimestampOther))
   {
          SYSTEMTIME st;
         if(myDtTime.GetAsSystemTime(st))
         {
               sysTime = st;
           }
   }
   else
   ASSERT(FALSE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM