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:
		| @@ -3371,26 +3371,18 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time) | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // try all time formats we may think about starting with the standard one |     // try all time formats we may think about in the order from longest to | ||||||
|     const wxChar *result = ParseFormat(time, _T("%X")); |     // shortest | ||||||
|  |  | ||||||
|  |     // 12hour with AM/PM? | ||||||
|  |     const wxChar *result = ParseFormat(time, _T("%I:%M:%S %p")); | ||||||
|  |  | ||||||
|     if ( !result ) |     if ( !result ) | ||||||
|     { |     { | ||||||
|         // normally, it's the same, but why not try it? |         // normally, it's the same, but why not try it? | ||||||
|         result = ParseFormat(time, _T("%H:%M:%S")); |         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 ) |     if ( !result ) | ||||||
|     { |     { | ||||||
|         // 12hour with AM/PM but without seconds? |         // 12hour with AM/PM but without seconds? | ||||||
| @@ -3399,8 +3391,8 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time) | |||||||
|  |  | ||||||
|     if ( !result ) |     if ( !result ) | ||||||
|     { |     { | ||||||
|         // just the hour? |         // without seconds? | ||||||
|         result = ParseFormat(time, _T("%H")); |         result = ParseFormat(time, _T("%H:%M")); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if ( !result ) |     if ( !result ) | ||||||
| @@ -3409,6 +3401,19 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time) | |||||||
|         result = ParseFormat(time, _T("%I %p")); |         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 |     // TODO: parse timezones | ||||||
|  |  | ||||||
|     return result; |     return result; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user