Skip to main content

DateTime

ToTimestamp

note

DateTime转时间戳

DateTime.Now.ToUniversalTime();

ToDateTime

note

时间戳转DateTime

now.ToTimestamp().ToDateTime();
caution

有精度问题,暂时没有很好的解决方案

DefaultString

note

提供了一些简单的DateTime格式化字符串方法

DateTime date = new(2021, 11, 11, 11, 11, 11);
date.ToDefaultDateString(); // 2021-11-11
date.ToDefaultTimeString(); // 2021-11-11 11:11:11
date.ToDefaultDateString("WTF"); // 2021WTF11WTF11
date.ToDefaultTimeString("WTF"); // 2021WTF11WTF11 11:11:11
info

后面可能会尝试添加更多的格式