fixed bug 419079 (wxDateTime::ParseTime() didn't find am/pm)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-06-09 17:00:36 +00:00
parent c4d305b7bd
commit c7f9a482ec

View File

@@ -3371,26 +3371,18 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time)
}
}
// try all time formats we may think about starting with the standard one
const wxChar *result = ParseFormat(time, _T("%X"));
// try all time formats we may think about in the order from longest to
// shortest
// 12hour with AM/PM?
const wxChar *result = ParseFormat(time, _T("%I:%M:%S %p"));
if ( !result )
{
// normally, it's the same, but why not try it?
result = ParseFormat(time, _T("%H:%M:%S"));
}
if ( !result )
{
// 12hour with AM/PM?
result = ParseFormat(time, _T("%I:%M:%S %p"));
}
if ( !result )
{
// without seconds?
result = ParseFormat(time, _T("%H:%M"));
}
if ( !result )
{
// 12hour with AM/PM but without seconds?
@@ -3399,8 +3391,8 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time)
if ( !result )
{
// just the hour?
result = ParseFormat(time, _T("%H"));
// without seconds?
result = ParseFormat(time, _T("%H:%M"));
}
if ( !result )
@@ -3409,6 +3401,19 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time)
result = ParseFormat(time, _T("%I %p"));
}
if ( !result )
{
// just the hour?
result = ParseFormat(time, _T("%H"));
}
if ( !result )
{
// parse the standard format: normally it is one of the formats above
// but it may be set to something completely different by the user
result = ParseFormat(time, _T("%X"));
}
// TODO: parse timezones
return result;