0

as I tried to ask in my title, I am talking about regional time format. I have an application that can display the time/date, but from US users I get the question of why am I displaying the time like this: 21:30 instead of this: 9:30PM. Same thing for the date to which I display the date as 22.05.2018 instead of 05.22.2018.

So my questions is: Is there a way to achieve getting a timezone flag or location or even the time already formatted so that I can display the time/date different for different regions?

1 Answers1

0

With Boost Locale

double now=time(0);
cout << as::datetime << as::local_time << "Local time is: "<< now << endl;
cout << as::gmt << "GMT Time is: "<< now <<endl;
cout << as::time_zone("EST") << "Eastern Standard Time is: "<< now <<endl;

Parse date from string back and add the time-zone

Victor Gubin
  • 2,782
  • 10
  • 24
  • Hello @Victor Gubin, is the std::locale an equivalent? –  May 22 '18 at 09:58
  • [boost locale](https://www.boost.org/doc/libs/1_67_0/libs/locale/doc/html/std_locales.html) simply implementing right facets for the std::locale functionality. – Victor Gubin May 22 '18 at 11:19