-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
82 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
| ||
using System.Globalization; | ||
|
||
namespace Fedora.Vocab; | ||
|
||
public static class MementoDateTime | ||
{ | ||
public const string Format = "yyyyMMddHHmmss"; | ||
|
||
public static DateTime DateTimeFromMementoTimestamp(this string mementoTimestamp) | ||
{ | ||
return DateTime.ParseExact(mementoTimestamp, Format, CultureInfo.InvariantCulture, DateTimeStyles.None); | ||
} | ||
|
||
public static string ToMementoTimestamp(this DateTime dt) | ||
{ | ||
return dt.ToString(Format); | ||
} | ||
|
||
public static string ToRFC1123(this DateTime dt) | ||
{ | ||
return dt.ToString(CultureInfo.InvariantCulture.DateTimeFormat.RFC1123Pattern); | ||
} | ||
|
||
public static string ToRFC1123(this string mementoTimestamp) | ||
{ | ||
return DateTimeFromMementoTimestamp(mementoTimestamp).ToRFC1123(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters