返回时间的各种格式
来源:互联网 发布:windows系统的平板 编辑:程序博客网 时间:2024/05/01 21:57
/// <summary>
/// 返回标准时间格式string
/// </summary>
public static string GetTime()
{
return DateTime.Now.ToString("HH:mm:ss");
}
/// <summary>
/// 返回标准时间格式string
/// </summary>
public static string GetDateTime()
{
return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
/// <summary>
/// 返回相对于当前时间的相对天数
/// </summary>
public static string GetDateTime(int relativeday)
{
return DateTime.Now.AddDays(relativeday).ToString("yyyy-MM-dd HH:mm:ss");
}
/// <summary>
/// 返回标准时间格式string
/// </summary>
public static string GetDateTimeF()
{
return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fffffff");
}
/// <summary>
/// 返回标准时间
/// </sumary>
public static string GetStandardDateTime(string fDateTime, string formatStr)
{
if (fDateTime == "0000-0-0 0:00:00")
{
return fDateTime;
}
DateTime s = Convert.ToDateTime(fDateTime);
return s.ToString(formatStr);
}
/// <summary>
/// 返回标准时间 yyyy-MM-dd HH:mm:ss
/// </sumary>
public static string GetStandardDateTime(string fDateTime)
{
return GetStandardDateTime(fDateTime, "yyyy-MM-dd HH:mm:ss");
}
- 返回时间的各种格式
- 各种时间格式的转换
- C#获取当前时间的各种返回格式(常用的)
- java中各种时间格式的转化
- java中各种时间格式的转化
- java中各种时间格式的转化
- DateFormat类输出各种格式的时间
- java中各种时间格式的转化
- java中各种时间格式的转化
- C#获取当前时间的各种格式
- java中各种时间格式的转化
- 获取系统时间的各种格式。。
- C#获取各种格式的系统时间
- 各种格式的时间日期正则表达式
- java 各种时间格式
- 时间各种格式转化
- wpf日期格式-修改返回的数据的时间格式
- delphi 时间格式返回
- Facebook初体验
- 如何用touch命令修改文件change时间
- ASP.net技术收集
- 工作手册
- C++模拟键盘输入
- 返回时间的各种格式
- 最新版的,你从未见过的MFC
- 错误处理(Error-Handling):为何、何时、如何(rev#2)
- 如何做好团队目标管理?
- jsp 中 js变量引用java变量时 特殊字符的处理
- osworkflow简单教程
- 点击IE关闭按钮弹出提示
- 摘录:阿里软件研发总监叶伟:如何处理技术和需求的矛盾
- 对.Net 垃圾回收的C#编程相关方面(Finalize 和Dispose(bool disposing)和 Dispose())的一些理解体会