I am writing a C++ app that has to parse a date/time string and give out epoch time. But the format of the date/time string can be more than one (actually say 25 formats) like
"EEE, dd MMM yyyy HH:mm:ss '('ZZZ')'",
"EEE, dd MMM yyyy HH:mm:ss '\"'ZZZ'\"'",
"EEE, dd MMM yyyy hh:mm:ss z",
"EEE, dd MMM yyyy HH:mm Z",
"EEE, dd MMM yyyy HH:mm:ss",
"EEE, MMM dd, yyyy 'at' HH:mm:ss z",
"EEE M/dd/yyyy hh:mm:ss a",
"EEE MMM dd HH:mm:ss z yyyy",
"EEE MMM dd hh:mm:ss yyyy",
"EEEE, MMMM dd, yyyy hh:mm:ss a",
"EEEE, MMMM dd, yyyy HH:mm a",
"EEEE, MMMM dd, yyyy HH:mm",
"MMM dd, yyyy hh:mm:ss a",
"dd MMM yyyy hh:mm:ss z",
"dd-MMM-yyyy HH:mm:ss z",
"dd MMM yy HH:mm:ss",
"MM/dd/yyyy hh:mm a (EEEE)",
"MM/dd/yyyy hh:mm a (EEEE)",
"MM/dd/yyyy hh:mm:ss",
"MM/dd/yyyy hh:mm a Z",
"MM/dd/yyyy hh:mma Z",
"MM/dd/yyyy hh:mma",
"MM/dd/yyyy hh:mm a",
"MM/dd/yyyy hh:mm Z",
"MM/dd/yy hh:mm a Z",
"MM/dd/yy hh:mma Z",
"MM/dd/yy HH:mm a",
"MM/dd/yy HH:mm Z",
"MM/dd/yyyy",
"yyyy-MM-dd HH:mm:ss",
"yyyyMMddhhmmss",
"yyyyMMddhhmm",
"yyyyMMdd"
Now, i need to take the string, figure out it belongs to which of these formats, then get the time in epoch.
Can you suggest a way to do this. Code samples will be really helpful. I am banking on Boost libraries. Let me know if this can be achieved by boost date/time parsing libraries.
Thanks in advance, AJ