29 lines
810 B
C#
29 lines
810 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
|
|||
|
|
namespace JiangsuEarthquake.Common
|
|||
|
|
{
|
|||
|
|
public class DateTimeConverter : IValueConverter
|
|||
|
|
{
|
|||
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
if (value is DateTime dateTime)
|
|||
|
|
{
|
|||
|
|
// 使用自定义的时间格式,例如:"yyyy-MM-dd HH:mm:ss"
|
|||
|
|
return dateTime.ToString("yyyy/MM/dd");
|
|||
|
|
}
|
|||
|
|
return value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|