Is there any function that converts a Month, Day, Year combination (e.g., "March 21, 2009"), to FILETIME
? I don't mind doing it manually using a SYSTEMTIME
, but anything Windows provides will be better than what I do. Thanks for any info.
Asked
Active
Viewed 146 times
1
-
Parsing this (which is a result) is a bit too late (especially with localized Windows). How did you get that string in the first place? That probably was a PROPVARIANT initially. – Simon Mourier Jan 17 '20 at 19:06
-
Well I'll be regexing it from a standard Outlook pdf email header, which is formatted using a long date. Actually I can probably regex for just the month, date, and year (and leave out the day of the week). But I still wasn't sure if there was a function to get that to a FILETIME. I assume I'll have to do it manually, which is fine. – Jan 17 '20 at 19:13
-
So, it's not coming from the Windows Property System, is it? If it's not, then it's not necessarily a PDFF_LONGDATE per se. – Simon Mourier Jan 17 '20 at 19:16
-
Oh, yeah, then I guess I should rephrase the question. – Jan 17 '20 at 19:17
-
You seem to be going the wrong direction. If you want data to be machine-readable, don't make it human-readable along the way. Parsing `March` is inherently harder than parsing `03`. I'm almost sure that you started out with a `FILETIME`. Keep that, and you won't have to apply a (lossy) conversion later on. – IInspectable Jan 17 '20 at 20:28
-
3There are a few ways in Windows to do string->date conversion, see https://devblogs.microsoft.com/oldnewthing/20121102-00/?p=6183. – Jonathan Potter Jan 17 '20 at 20:28
-
@Jonathan Potter - Thank you very much. Not sure how I missed those. – Jan 17 '20 at 21:36
-
1@loop123123 you should always remember to check the official documentation, a.k.a. Raymond's blog ;) – Jonathan Potter Jan 17 '20 at 22:01
-
1Yes definitely. If you want to make your comment an answer, I'll mark it as accepted. – Jan 18 '20 at 00:08