Re: [Cppcms-users] How to store/manipulate dates?
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-02-06 09:41:14
|
> >> If you want to store only date you have two options: >> >> Use string and format it as "YYYY-MM-DD" or >> use std::tm with relevant fields set if the SQL engine >> knows to convert one type to another. > > > Thanks a lot. It makes much more sense to me now. > > What if I want a date iterator for example? See: Boost.Locale date-time tutorial: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/dates_times_timezones.html Calendar example: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/calendar_8cpp-example.html Note Booster.Locale == Boost.Locale in different namespace so everything applicable to Boost.Locale is same for Booster.Locale. > Should I just use > boost::date_time? >(since Im 99% certain i'll only be using gregorian > calendar anyway) Or does booster offer something similar? > You can use boost::date_time but... I'd recommend to use boost(er)::locale::date_time as it offers more power as it locale dependent. See: http://www.boost.org/doc/libs/1_48_0/libs/locale/doc/html/dates_times_timezones.html#dates_times_timezones_qn For example what if you want to display a calendar for a current month? Where should you start a week at? boost(er)::locale::date_time gives you that knowledge while Boost.DateTime does not. So it is really up-to-you Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |