You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.UI/Converters/DateTimeToStringConverter.cs

35 lines
934 B

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();
}
}
}