about the Data_time; How I can init a ptime that only have the time no the date;

As I knew : construct a ptime use the ptime("2002-01-20 23:59:59.000"); 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?!

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
participants (2)
-
"帅哥:->代小飞"
-
Jeff Garland