forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateTimeHelper.cs
More file actions
29 lines (26 loc) · 951 Bytes
/
Copy pathDateTimeHelper.cs
File metadata and controls
29 lines (26 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
namespace NETworkManager.Utilities;
/// <summary>
/// Class provides static methods to convert DateTime to string.
/// </summary>
public static class DateTimeHelper
{
/// <summary>
/// Convert a DateTime to a string with the format "yyyy-MM-dd HH:mm:ss.fff".
/// </summary>
/// <param name="dateTime">DateTime to convert.</param>
/// <returns>String with the format "yyyy-MM-dd HH:mm:ss.fff".</returns>
public static string DateTimeToFullDateTimeString(DateTime dateTime)
{
return dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
}
/// <summary>
/// Convert a DateTime to a string with the format "HH:mm:ss".
/// </summary>
/// <param name="dateTime">DateTime to convert.</param>
/// <returns>String with the format "HH:mm:ss".</returns>
public static string DateTimeToTimeString(DateTime dateTime)
{
return dateTime.ToString("HH:mm:ss");
}
}