Questions tagged [coledatetime]
25 questions
5
votes
2 answers
How do I convert from MFC's COleDateTime to C# DateTime?
I have an older library that uses COleDateTime as a return type in a C++ MFC Dll. When I do a PInvoke, can I marshal that with confidence to a DateTime object? Or should I do something wacky, like convert the COleDateTime into the number of ticks…

mmr
- 14,781
- 29
- 95
- 145
3
votes
2 answers
want to convert ColeDateTime to CTime
I am reading a datetime from database in a ColeDateTime format. I want to convert it to CTime to get the date month year and time.
CString repDt; //**this will hold the datetime which i read from Database**
COleDateTime dt;
//**my datetime format…

sshah
- 63
- 1
- 5
3
votes
2 answers
Getting COleDateTime::Format to return "stycznia" instead of "styczeń" for Polish month "January"
I have this method to set the locale to Polish:
void CMeetingScheduleAssistantApp::SetLocale()
{
// https://www.microsoft.com/resources/msdn/goglobal/default.mspx#ISO2
CString strLang[NUM_LANGUAGES] =
{
_T("plk")
// Add…

Andrew Truckle
- 17,769
- 16
- 66
- 164
3
votes
2 answers
C++ What is the correct use of LCID in COleDateTime for American Date
I need to parse an american date string to extract the date.
COleDateTime dData;
LCID lcid = 0x409; // 0x409 is the locale ID for English US
CString strDate;
dData.ParseDateTime("10/1/2014 9:43:00 AM", VAR_DATEVALUEONLY);
strDate =…

AnR
- 1,809
- 3
- 26
- 45
3
votes
3 answers
OLEDate java implementation
I need a good OLEDate java implementation, and this one does not seem to be working. Is there any known good opensource implementations (like in apache commons)? If not, where do I read about it, so that I write my own implementation?

George
- 8,368
- 12
- 65
- 106
3
votes
1 answer
Subtract days with ColeDateTimeSpan to a ColeDateTime
I have to update an old date class for one of my assignment and I'm stuck on this function I have to redo.
The function needs to return a Bool if the operation is possible.
What I want to do is subtract days with ColeDateTimeSpan to a ColeDateTime
I…

SKTLZ
- 163
- 1
- 4
- 12
2
votes
1 answer
COleDateTime adding an hour when constructed with time_t
I have a struct tm object that is converted to UNIX time_t using mktime, that when passed into the constructor of COleDateTime seems to be adding an hour to account for daylight savings (UK time), even though the documentation for COleDateTime…

Jack K
- 82
- 5
2
votes
1 answer
C++ ParseDateTime() - SQL datetime as UK date
I have dates stored in datetime in an MSSQL database. In my C++ application, these dates are pulled out of the database and stored in a CString.
I am trying to use COleDateTime's ParseDateTime() to display these dates in a nice format. However I…

Raiden616
- 1,545
- 3
- 18
- 42
1
vote
1 answer
Is there another way to get a COleDateTime object from another dialog using SendMessage?
I have a registered user message. This is the handler:
afx_msg LRESULT CChristianLifeMinistryEditorDlg::OnGetDate(WPARAM wParam, LPARAM lParam)
{
const auto eDateType = gsl::narrow(wParam);
if (eDateType ==…

Andrew Truckle
- 17,769
- 16
- 66
- 164
1
vote
3 answers
How can I parse a std::string (YYYY-MM-DD) into a COleDateTime object?
I have a COleDateTime object and I want to parse a date string in the format YYYY-MM-DD.
The string variable, for example, is:
std::string strDate = "2022-07-04";
COleDateTime allows me to use ParseDateTime to parse a string, but I see no way to…

Andrew Truckle
- 17,769
- 16
- 66
- 164
1
vote
1 answer
how to distinguish between no time and midnight in COleDateTime class
We use the DD-MM-YYYY HH:mm:ss date and time format API between frontend and backend.
However, there are cases that backend gets only the date since time wasn’t selected at the frontend side.
The GET call parameter will look like…

אורלי פרייב
- 13
- 2
1
vote
1 answer
COleDateTime::SetDateTime and noexcept (code analysis)
See this code:
COleDateTime CSpecialEventDlg::GetSpecialEventDate() noexcept
{
COleDateTime datEvent;
if (datEvent.SetDateTime(m_datEvent.GetYear(),
m_datEvent.GetMonth(),
m_datEvent.GetDay(),
0, 0, 0)…

Andrew Truckle
- 17,769
- 16
- 66
- 164
1
vote
1 answer
Unreliable DateTime parsing by COleDateTime
I am trying to parse the date using ParseDateTime method provided by COleDateTime class. But parsing of two different dates in the same program is returning inconsisent values for the month.
Code Snippet:
COleDateTime…

user2756695
- 676
- 1
- 7
- 22
1
vote
1 answer
What is the right way to add a year to COledateTime taking into account leap years?
I have this code:
COleDateTime datStart = COleDateTime::GetCurrentTime(), datEnd;
// Update end date (one year later)
datEnd.SetDateTime(datStart.GetYear() + 1,
datStart.GetMonth(),
datStart.GetDay(),
datStart.GetHour(),
…

Andrew Truckle
- 17,769
- 16
- 66
- 164
1
vote
1 answer
Convert OLE Automation Date (OADate) double to struct tm without using VariantTimeToSystemTime
I'm writing a Windows DLL in mostly std C++ (VS2010), which does not use MFC/ATL.
A parent module does use MFC and passes a COleDateTime.m_dt to my DLL, which arrives as a double. I believe this is an OLE Automation Date, also known as OADate.
I…

Philip Beck
- 375
- 2
- 10