Re: [Cppcms-users] How to store/manipulate dates?
Brought to you by:
artyom-beilis
From: <ele...@ex...> - 2012-02-06 06:43:16
|
Another update - reading the locale docs, i found out I have to install a default global locale to use date_time Right now what I do is this - std::tm created_at = r.get<std::tm>("created_at"); c.topics[i].created_at = mktime(&created_at); created_at is of data type date_time. Is there any library function to make it less complicated so I dont have to first convert tm to time_t and then to date_time? Thanks Petr > A little update, using just <ctime>, by fetching the timestamp as std::tm > and then converting it to time_t works. However, I noticed another issue. > > struct topic{ > topic() : id(0) {} > std::string title; > std::string body; > booster::locale::date_time created_at; > int id; > }; > > Using date_time hits exception - std::bad_cast. I've actually removed > every reference to created_at in the code and it seems that by merely > including in the struct, it causes the server to error 500. > > The struct gets copied into a vector that holds all the topics. > > I assume this is a bug. > > Petr > >> Hi, >> >> Essentially my problem is this - I need to load timestamp from a >> database >> table, what data type should I use to store it? (I see >> booster::locale::date_time, is that it?) >> >> Cheers, >> Petr Janda >> >> >> ------------------------------------------------------------------------------ >> Try before you buy = See our experts in action! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-dev2 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |