How to write the follow simple DateUtil in C#(.net) ?
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
oh~
try this tool Octopus .NET Translator
or this XES
if u can Over the wall~