The follow DateUtil is written in Java. How to write it in C#(.net), especially about the "Locale" ?
java的日期类和C#的日期类有哪些对应关系?求科普
/// <summary>
/// 日期工具类
/// </summary>
public class DateUtil
{
public const string DATE_PATTERN = "yyyy-MM-dd";
public const string DATE_PATTERN_SIMPLE = "yyyyMMdd";
public const string LOG_DATE_PATTERN = "dd/MMM/yyyy";
public const string HOUR_PATTERN = "yyyy-MM-dd-HH";
public const string MIN_PATTERN = "yyyy-MM-dd-HH-mm";
public const string SIMPLE_SECOND_PATTERN = "yyyyMMddHHmmss";
public const string COMMON_PATTERN = "yyyy-MM-dd HH:mm:ss";
public const string TIME_PATTERN = "HH:mm:ss";
public const string TIME_MIN_PATTERN = "HH:mm";
public static readonly Locale US = Locale.US;
public const string CHART_DATE_PATTERN = "%Y-%m-%d";
public const string CHART_HOUR_PATTERN = "%Y-%m-%d-%H";
private const int ONE = 1;
public static long yesterdayBeginTime()
{
DateTime calendar = new DateTime();
calendar.AddDays(-1);
calendar.set(DateTime.HOUR_OF_DAY, 0);
calendar.set(DateTime.MINUTE, 0);
calendar.set(DateTime.SECOND, 0);
calendar.set(DateTime.MILLISECOND, 0);
return calendar.TimeInMillis;
}
oh~
try this tool Octopus .NET Translator
or this XES
if u can Over the wall~