| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Basic time formatting methods. These methods use the current locale | 5 // Basic time formatting methods. These methods use the current locale |
| 6 // formatting for displaying the time. | 6 // formatting for displaying the time. |
| 7 | 7 |
| 8 #ifndef BASE_I18N_TIME_FORMATTING_H_ | 8 #ifndef BASE_I18N_TIME_FORMATTING_H_ |
| 9 #define BASE_I18N_TIME_FORMATTING_H_ | 9 #define BASE_I18N_TIME_FORMATTING_H_ |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 TimeFormatShortDateAndTimeWithTimeZone(const Time& time); | 80 TimeFormatShortDateAndTimeWithTimeZone(const Time& time); |
| 81 | 81 |
| 82 // Formats a time in a friendly sentence format, e.g. | 82 // Formats a time in a friendly sentence format, e.g. |
| 83 // "Monday, March 6, 2008 2:44:30 PM". | 83 // "Monday, March 6, 2008 2:44:30 PM". |
| 84 BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time); | 84 BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time); |
| 85 | 85 |
| 86 // Formats a time in a friendly sentence format, e.g. | 86 // Formats a time in a friendly sentence format, e.g. |
| 87 // "Monday, March 6, 2008". | 87 // "Monday, March 6, 2008". |
| 88 BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time); | 88 BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time); |
| 89 | 89 |
| 90 // Formats a time using a skeleton to produce a format for different locales |
| 91 // when an unusual time format is needed, e.g. "Feb. 2, 18:00". |
| 92 // |
| 93 // See http://userguide.icu-project.org/formatparse/datetime for details. |
| 94 BASE_I18N_EXPORT string16 TimeFormatWithPattern(const Time& time, |
| 95 const char* pattern); |
| 96 |
| 90 // Formats a time duration of hours and minutes into various formats, e.g., | 97 // Formats a time duration of hours and minutes into various formats, e.g., |
| 91 // "3:07" or "3 hours, 7 minutes". See DurationFormatWidth for details. | 98 // "3:07" or "3 hours, 7 minutes". See DurationFormatWidth for details. |
| 92 // | 99 // |
| 93 // Please don't use width = DURATION_WIDTH_NUMERIC when the time duration | 100 // Please don't use width = DURATION_WIDTH_NUMERIC when the time duration |
| 94 // can possibly be larger than 24h, as the hour value will be cut below 24 | 101 // can possibly be larger than 24h, as the hour value will be cut below 24 |
| 95 // after formatting. | 102 // after formatting. |
| 96 // TODO(chengx): fix function output when width = DURATION_WIDTH_NUMERIC | 103 // TODO(chengx): fix function output when width = DURATION_WIDTH_NUMERIC |
| 97 // (http://crbug.com/675791) | 104 // (http://crbug.com/675791) |
| 98 BASE_I18N_EXPORT string16 TimeDurationFormat(const TimeDelta time, | 105 BASE_I18N_EXPORT string16 TimeDurationFormat(const TimeDelta time, |
| 99 const DurationFormatWidth width); | 106 const DurationFormatWidth width); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 118 DateFormat format); | 125 DateFormat format); |
| 119 | 126 |
| 120 // Gets the hour clock type of the current locale. e.g. | 127 // Gets the hour clock type of the current locale. e.g. |
| 121 // k12HourClock (en-US). | 128 // k12HourClock (en-US). |
| 122 // k24HourClock (en-GB). | 129 // k24HourClock (en-GB). |
| 123 BASE_I18N_EXPORT HourClockType GetHourClockType(); | 130 BASE_I18N_EXPORT HourClockType GetHourClockType(); |
| 124 | 131 |
| 125 } // namespace base | 132 } // namespace base |
| 126 | 133 |
| 127 #endif // BASE_I18N_TIME_FORMATTING_H_ | 134 #endif // BASE_I18N_TIME_FORMATTING_H_ |
| OLD | NEW |