|
@@ -1,40 +1,10 @@
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
-using System.Linq;
|
|
|
|
|
|
|
|
namespace DesktopClock;
|
|
namespace DesktopClock;
|
|
|
|
|
|
public static class DateTimeUtil
|
|
public static class DateTimeUtil
|
|
{
|
|
{
|
|
- /// <summary>
|
|
|
|
- /// A collection of DateTime formatting strings.
|
|
|
|
- /// </summary>
|
|
|
|
- public static IReadOnlyList<string> DateTimeFormats { get; } = new[]
|
|
|
|
- {
|
|
|
|
- "M",
|
|
|
|
- "dddd, MMMM dd",
|
|
|
|
- "dddd, MMMM dd, HH:mm",
|
|
|
|
- "dddd, MMM dd, HH:mm",
|
|
|
|
- "dddd, MMM dd, HH:mm:ss",
|
|
|
|
- "ddd, MMMM dd, HH:mm",
|
|
|
|
- "ddd, MMMM dd, HH:mm:ss",
|
|
|
|
- "ddd, MMM dd, HH:mm",
|
|
|
|
- "ddd, MMM dd, HH:mm:ss",
|
|
|
|
- "ddd, MMM dd, HH:mm K",
|
|
|
|
- "d",
|
|
|
|
- "g",
|
|
|
|
- "G",
|
|
|
|
- "t",
|
|
|
|
- "T",
|
|
|
|
- "O",
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// Common date time formatting strings and an example string for each.
|
|
|
|
- /// </summary>
|
|
|
|
- public static IReadOnlyDictionary<string, string> DateTimeFormatsAndExamples { get; } =
|
|
|
|
- DateTimeFormats.ToDictionary(f => f, DateTimeOffset.Now.ToString);
|
|
|
|
-
|
|
|
|
public static IReadOnlyCollection<TimeZoneInfo> TimeZones { get; } = TimeZoneInfo.GetSystemTimeZones();
|
|
public static IReadOnlyCollection<TimeZoneInfo> TimeZones { get; } = TimeZoneInfo.GetSystemTimeZones();
|
|
|
|
|
|
public static bool TryGetTimeZoneById(string timeZoneId, out TimeZoneInfo timeZoneInfo)
|
|
public static bool TryGetTimeZoneById(string timeZoneId, out TimeZoneInfo timeZoneInfo)
|