1. 程式人生 > >WPF轉換器:時間轉換為字符串

WPF轉換器:時間轉換為字符串

color datetime val gpo test style log ati inf

public object Convert(object value, Type targetType, object parameter,
                      System.Globalization.CultureInfo culture)
{
    if (value is DateTime)
    {
        DateTime test = (DateTime) value;
        string date = test.ToString("d/M/yyyy");
        return date;
    }

    return
string.Empty; }

WPF轉換器:時間轉換為字符串