datetime - Date/Time parsing in C++ (Any format string to Epoch) -


I am writing a C + + app that parsing a date / time string and giving time to the era. But the format of the date / time string can be more than one (in fact 25 formats may have meaning) such as

So get time in the era.

Can you recommend a way to do this? Code samples will really be helpful. I am banking on boost libraries. Let me tell you whether this boost date / time can be obtained by parsing libraries.

In advance, AJ

I think that you can put your string in Using each of the formats, you can try to convert it to PTT and you can choose people who are not in not_a_date_time .

This is slightly different from yours, I will only do the last five for this example:

  #include & lt; Iostream & gt; # Include & lt; Boost / date_time / posix_time / posix_time.hpp & gt; Promotion: posix_time :: time_input_facet; Using Std :: locale; Cant local locale [] = {location (locale :: classic (), new time_input_faces ("% m /% d /% Y"), locale (local :: classic (), new time_input_faceat ("% Y-% m - Local Time (local :: Classic), New Time_Input_Factory ("% Y% m% d% H% M% S"), Locale (Local :: Classic (), New Time_Input_Face ("% Y% m% d% New Time_Input_Factet ("% Y% m% d")); Const size_t format = size (input) / size (input [0]); time_t ptime_to_time_t (Promotion: posix_time :: ptime t) {static bust :: posix_time :: ptime epoch (increasing Java :: Gregory :: Date (1970,1,1); Return (T-era). Stamps () / Prompt: posix_time :: time_duration :: ticks_per_second ();} Int main () {std :: string Msg = "size_t i = 0; i  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -