How to specify format for wxAutomationObject date property Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
sw
Knows some wx things
Knows some wx things
Posts: 47
Joined: Sat Mar 16, 2019 8:09 pm

How to specify format for wxAutomationObject date property

Post by sw » Wed Sep 09, 2020 8:06 am

I am reading meetings from Outlook using wxAutomationObject's and one of those properties is a DateTime, so to speak (it comes as a string).

The problem is that when reading it via wxAutomationObject.GetProperty, the format of date comes out as so:

Code: Select all

Mon Sep  7 12:00:00 2020
The equivalent VBA code (run in the Outlook VBA IDE) returns this:

Code: Select all

2020/09/07 13:30:00
Is there a way to specify the format of the date? Ideally a ISO date so I can use wxDateTime::ParseISOCombined()

The locale on the wxAutomationObject is set to:

Code: Select all

mOutlookApplication.SetLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
Which is the same locale as Outlook is using...

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2650
Joined: Sun Jan 03, 2010 5:45 pm

Re: How to specify format for wxAutomationObject date property

Post by PB » Wed Sep 09, 2020 8:56 am

Do you really receive the property as wxVariant with type "string" and not "datetime"? If the Outlook property type is Date, should it not be returned as OLEVARIANT with VT_DATE? If so, wxConvertOleToVariant() should convert it correctly (the function does not handle VT_FILETIME), you could debug what happens there...

sw
Knows some wx things
Knows some wx things
Posts: 47
Joined: Sat Mar 16, 2019 8:09 pm

Re: How to specify format for wxAutomationObject date property

Post by sw » Wed Sep 09, 2020 10:05 am

It was a PEBKAC error...

I did not realize I could get a wxDateTime on the wxVariant. Thank you for your help @PB

Post Reply