My question is similar to this one, however, I don't want to get the date format of the locale
, but the one set by the user. The reason is that I am using the pywin32
api to communicate with Outlook, specifically to filter mails by date. The format in which I have to pass the date to the application is the one set by the user, otherwise it won't work.
So the code looks like this:
inbox = outlook.Session.GetSharedDefaultFolder(user, 6)
mails = inbox.Items.Restrict(
"[ReceivedTime] > '{}'".format(retrieve_from.strftime(local_date_fmt))
)
If anyone knows how to do this without passing the date in the user defined format, that would also solve my problem.
EDIT:
I am referring to the short date format set in the region settings in this window:
So in this case, local_date_fmt
would be set to %Y-%m-%d
.