| 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 #include "base/i18n/time_formatting.h" | 5 #include "base/i18n/time_formatting.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 icu::DateFormat::createDateInstance(icu::DateFormat::kShort)); | 99 icu::DateFormat::createDateInstance(icu::DateFormat::kShort)); |
| 100 return TimeFormat(formatter.get(), time); | 100 return TimeFormat(formatter.get(), time); |
| 101 } | 101 } |
| 102 | 102 |
| 103 string16 TimeFormatShortDateAndTime(const Time& time) { | 103 string16 TimeFormatShortDateAndTime(const Time& time) { |
| 104 scoped_ptr<icu::DateFormat> formatter( | 104 scoped_ptr<icu::DateFormat> formatter( |
| 105 icu::DateFormat::createDateTimeInstance(icu::DateFormat::kShort)); | 105 icu::DateFormat::createDateTimeInstance(icu::DateFormat::kShort)); |
| 106 return TimeFormat(formatter.get(), time); | 106 return TimeFormat(formatter.get(), time); |
| 107 } | 107 } |
| 108 | 108 |
| 109 string16 TimeFormatShortDateAndTimeWithTimeZone(const Time& time) { |
| 110 scoped_ptr<icu::DateFormat> formatter(icu::DateFormat::createDateTimeInstance( |
| 111 icu::DateFormat::kShort, icu::DateFormat::kLong)); |
| 112 return TimeFormat(formatter.get(), time); |
| 113 } |
| 114 |
| 109 string16 TimeFormatFriendlyDateAndTime(const Time& time) { | 115 string16 TimeFormatFriendlyDateAndTime(const Time& time) { |
| 110 scoped_ptr<icu::DateFormat> formatter( | 116 scoped_ptr<icu::DateFormat> formatter( |
| 111 icu::DateFormat::createDateTimeInstance(icu::DateFormat::kFull)); | 117 icu::DateFormat::createDateTimeInstance(icu::DateFormat::kFull)); |
| 112 return TimeFormat(formatter.get(), time); | 118 return TimeFormat(formatter.get(), time); |
| 113 } | 119 } |
| 114 | 120 |
| 115 string16 TimeFormatFriendlyDate(const Time& time) { | 121 string16 TimeFormatFriendlyDate(const Time& time) { |
| 116 scoped_ptr<icu::DateFormat> formatter(icu::DateFormat::createDateInstance( | 122 scoped_ptr<icu::DateFormat> formatter(icu::DateFormat::createDateInstance( |
| 117 icu::DateFormat::kFull)); | 123 icu::DateFormat::kFull)); |
| 118 return TimeFormat(formatter.get(), time); | 124 return TimeFormat(formatter.get(), time); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // See http://userguide.icu-project.org/formatparse/datetime for details | 158 // See http://userguide.icu-project.org/formatparse/datetime for details |
| 153 // about the date/time format syntax. | 159 // about the date/time format syntax. |
| 154 if (pattern_unicode.indexOf('a') == -1) { | 160 if (pattern_unicode.indexOf('a') == -1) { |
| 155 return k24HourClock; | 161 return k24HourClock; |
| 156 } else { | 162 } else { |
| 157 return k12HourClock; | 163 return k12HourClock; |
| 158 } | 164 } |
| 159 } | 165 } |
| 160 | 166 |
| 161 } // namespace base | 167 } // namespace base |
| OLD | NEW |