Boost logo

Boost Users :

From: Rakesh Kumar (rakesh_usenet_at_[hidden])
Date: 2004-12-20 01:22:46


Hi,
  I was going through the API to parse a date-time
field. I came across the boost library regarding the
same.

#include "boost/date_time/posix_time/posix_time.hpp"

using namespace boost::posix_time;
#include <iostream>
#include <cstdlib>

using std::cout;

int main() {
         std::string ts("2002-01-20 23:59:59.000");
        ptime t(time_from_string(ts));

        cout << to_simple_string(t);
        return EXIT_SUCCESS;
}

This example compiled fine and gave me the right
results. But suppose if I have another date
representation as follows.

06 Dec 2004 10:40:58.000

If I enter the same string and try to parse from it,
the method time_from_string aborts. I was wondering if
there is any way I can tell time_from_string the
format and try to parse from it.

                
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net