Hi,
I use the below code to convert string date to wxDateTime.
The month return alway less one month.
Am i do a mistake or is this a bug in wxWidget?
Version : wxWidgets-2.6.3
wxDateTime dt;
dt.ParseFormat(wxT("17-Jan-2005 11:20:21"),wxT("%d-%b-%Y %T"));
if (dt.IsValid()) {
wxLogDebug(wxString::Format(wxT("Year=%i Month=%i Day=%i"),dt.GetYear(),dt.GetMonth(),dt.GetDay()));
}
"17-Jan-2005 11:20:21"
result : Year=2005 Month=0 Day=17
"17-Oct-2005 11:20:21"
result: Year=2005 Month=9 Day=17
Regards
Teh
wxDateTime::Parseformat return less one month Topic is solved
-
- Knows some wx things
- Posts: 26
- Joined: Tue Nov 14, 2006 1:51 pm
- Location: Duesseldorf, Germany
In this case, after PasteFormat, to display the expected month i should
increase it by one.
dt.ParseFormat("17-Jan-2005 11:20:21",wxT("%d-%b-%Y %T"));
wxLogDebug(wxString::Format(wxT("Year=%i Month=%i Day=%i"),dt.GetYear(),dt.GetMonth()+1,dt.GetDay()));
Thank
increase it by one.
dt.ParseFormat("17-Jan-2005 11:20:21",wxT("%d-%b-%Y %T"));
wxLogDebug(wxString::Format(wxT("Year=%i Month=%i Day=%i"),dt.GetYear(),dt.GetMonth()+1,dt.GetDay()));
Thank
Last edited by bcteh on Tue Dec 19, 2006 3:50 am, edited 1 time in total.