21 lines
462 B
C#
21 lines
462 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace ExtensionMethods
|
|||
|
|
{
|
|||
|
|
public static class DateTimeExtension
|
|||
|
|
{
|
|||
|
|
public static string ToLongFormat(this DateTime dateTime)
|
|||
|
|
{
|
|||
|
|
return dateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static string ToShortFormat(this DateTime dateTime)
|
|||
|
|
{
|
|||
|
|
return dateTime.ToString("yyyy-MM-dd");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|