views:

18

answers:

1

I have the date in a string in the following format.

Fri 4/2/2004 9:55:54 AM

I would like to have a generic time utility in c++ which parses this and provides me the long/int representation which is either the epoc time base or Jan 1st 0001 time base.

(Wish list) Also, it will be good if the util is fairly generic, in the sense that, even if there is a slightly different format in the string it should work. Basically the util should support more than one string format to integer representation.

I want this in C++ on Unix (ubuntu). Can somebody help.

Rgds, AJ

+2  A: 

You might want to try strptime

sje397
The example in the linked-to documentation for strptime contains code to do almost exactly what the question asks for.
Anthony Williams