aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-20 11:25:22 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-20 11:25:22 -0400
commit119dfc3ac70db7536e86191eb3c89ffa1fd4f576 (patch)
tree1e1deafbcba09b5ffd40ac6883207de778d707e7 /MediaBrowser.UI/Converters/DateTimeToStringConverter.cs
parentd8c01ded6eb57ba312e1cd62c4fa51dbcce6053a (diff)
Adding the UI to the same repo. Made some default theme progress
Diffstat (limited to 'MediaBrowser.UI/Converters/DateTimeToStringConverter.cs')
-rw-r--r--MediaBrowser.UI/Converters/DateTimeToStringConverter.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs b/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs
new file mode 100644
index 000000000..6c568c061
--- /dev/null
+++ b/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace MediaBrowser.UI.Converters
+{
+ public class DateTimeToStringConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var date = (DateTime)value;
+
+ string format = parameter as string;
+
+ if (string.IsNullOrEmpty(format))
+ {
+ return date.ToString();
+ }
+
+ if (format.Equals("shorttime", StringComparison.OrdinalIgnoreCase))
+ {
+ return date.ToShortTimeString();
+ }
+
+ return date.ToString(format);
+ }
+
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}