Menu

#98 booster::locale::as::ftime produces unexpected results

cppcms-v1.0.x
closed
nobody
None
1
2014-10-30
2013-06-25
Petr Janda
No

Hi Artyom,

Simple test:

include <booster locale.h=""></booster>

include <iostream></iostream>

include <sstream></sstream>

using namespace booster::locale;
using namespace std;

int main()
{
generator gen;
std::locale::global(gen(""));
std::cout.imbue(std::locale());

    string str1="2010-08-10";
    string str2="10-08-2010";

    istringstream is(str1);
    date_time dt;

    is >> as::ftime("%Y-%m-%d") >> dt;
    cout << as::date << dt << endl;

    istringstream is2(str2);
    date_time dt2;

    is2 >> as::ftime("%d-%m-%Y") >> dt2;
    cout << as::date << dt2 << endl;

}

Prints:

[petr@petr-archlinux ~]$ ./a.out
10/08/2010
20/12/2009

Discussion

  • Petr Janda

    Petr Janda - 2013-06-25

    Sorry, it seems like source forge didnt format the text properly. ive put it in a text file and uploaded it

     
  • Artyom Beilis

    Artyom Beilis - 2014-10-29

    Related to: #121

    code used year of week instead of year

    fixed

     
  • Artyom Beilis

    Artyom Beilis - 2014-10-29
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel