|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2005-01-21 08:28:48
On Fri, 21 Jan 2005 15:03:57 +0800, ˧¸ç:->´úС·É wrote
> As I knew :
> construct a ptime use the ptime("2002-01-20 23:59:59.000");
Since the constructor doesn't take a string I assume you mean:
ptime(date(2002,01,20), time_duration(23,59,59));
> but now I want to init a ptime look like ptime("23:59:59.000");when I
> use this funcation,a exception is show!
> any body can tell me ,,How Can i do?!
I'm not entirely sure what you are asking to do. Are you asking for a time
duration only? Like this?
time_duration td(23,59,59);
or more clearly
time_duration td = hours(23) + minutes(59) + seconds(59);
or if you really need to construct from string:
std::string ts("23:59:59.000");
time_duration td(duration_from_string(ts));
ptime is a fixed point in time and requires the specification of a date part
-- time_duration doesn't. Hope that helps...
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk