DateTime data types and utilities for RBE (Rapid Business Engineering) shared components.
- UTC DateTime Parsing: Parse DateTime strings from multiple UTC formats
- UTC DateTime Formatting: Format DateTime objects to standardized UTC strings
- Format Validation: Validate if a string matches supported UTC DateTime formats
- Multiple Format Support: Support for various precision levels (milliseconds, single/double decimals)
Install-Package Temabit.Rbe.DataTypes.DateTimedotnet add package Temabit.Rbe.DataTypes.DateTime<PackageReference Include="Temabit.Rbe.DataTypes.DateTime" Version="0.1.0" />using Temabit.Rbe.DataTypes.DateTime;
// Parse UTC DateTime string
string utcString = "2025-09-29T14:30:45.123Z";
DateTime? parsedDate = utcString.ParseUtcString();
// Format DateTime to UTC string
DateTime now = DateTime.UtcNow;
string formattedUtc = now.FormatAsUtcString();
// Validate UTC format
bool isValidFormat = utcString.HasValidUtcFormat();The library supports the following UTC DateTime formats:
yyyy-MM-ddTHH:mm:ss.fffZ(Standard UTC with milliseconds)yyyy-MM-ddTHH:mm:ssZ(UTC without fractional seconds)yyyy-MM-ddTHH:mm:ss.fZ(UTC with one decimal place)yyyy-MM-ddTHH:mm:ss.ffZ(UTC with two decimal places)
// Access predefined format constants
string standardFormat = DateTimeFormats.StandardUtc;
string[] allFormats = DateTimeFormats.AllSupportedUtcFormats;Parses a UTC DateTime string and returns a DateTime? object.
Parameters:
input: The UTC DateTime string to parse
Returns:
DateTime?: Parsed DateTime object, ornullif parsing fails
Validates if a string matches supported UTC DateTime formats.
Parameters:
input: The string to validate
Returns:
bool:trueif the format is valid,falseotherwise
Formats a DateTime object to the standard UTC string format.
Parameters:
timestamp: The DateTime object to format
Returns:
string: Formatted UTC DateTime string
Contains predefined DateTime format constants:
StandardUtc: Standard UTC format with millisecondsUtcWithoutMilliseconds: UTC format without fractional secondsUtcWithOneDecimal: UTC format with one decimal placeUtcWithTwoDecimals: UTC format with two decimal placesAllSupportedUtcFormats: Array containing all supported formats
- .NET 8.0 or later
- C# 10.0 or later
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project uses Conventional Commits. Please format your commit messages as:
feat:for new featuresfix:for bug fixesdocs:for documentation changesrefactor:for refactoringtest:for adding testschore:for maintenance tasks
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a list of changes and releases.
For questions, issues, or contributions, please visit our GitHub repository.