blob: 6c568c0612987cc6d8c3d907c1688cb9a70f3fd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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();
}
}
}
|