StrftimeParser 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package StrftimeParser --version 0.1.0                
NuGet\Install-Package StrftimeParser -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StrftimeParser" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StrftimeParser --version 0.1.0                
#r "nuget: StrftimeParser, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StrftimeParser as a Cake Addin
#addin nuget:?package=StrftimeParser&version=0.1.0

// Install StrftimeParser as a Cake Tool
#tool nuget:?package=StrftimeParser&version=0.1.0                

StrftimeParser

StrftimeParser is a .NET Standard 2.0 library that allows you to work with C-style strftime string formats within .NET.

The project provides a main class called Strftime that exposes a static method Parse, which allows to convert a formatted string to a DateTime object

Usage

To use StrftimeParser in your .NET project, follow these simple steps:

  1. Add the NuGet package StrftimeParser to your .NET project.

  2. Import the StrftimeParser namespace in your code file.

  3. Call the static method Parse of the Strftime class and pass a string in the C-style strftime format as a parameter, plus the format used.

  4. Use the DateTime object returned by the Parse method to manipulate the formatted date.

Here an example of code:

using StrftimeParser;


string strftimeString = "2001-08-23 14:55:02";
string formatSpecifier = "%Y-%m-%d %H:%M:%S";

DateTime dateTime = Strftime.Parse(strftimeString, formatSpecifier);

// dateTime now contains the formatted date as a .NET DateTime object

How to Use a specified CultureInfo

To execute the parsing with a specific Culture, you can pass a CultureInfo instance to the Parse method:

DateTime dateTime = Strftime.Parse(strftimeString, formatSpecifier, CultureInfo.GetCultureInfo("it-IT"));

// dateTime now contains the formatted date as a .NET DateTime object

Compatibility

At the moment, StrftimeParser supports these format specifiers:

  • %a - Abbreviated weekday name *
  • %A - Full weekday name *
  • %b - Abbreviated month name *
  • %B - Full month name *
  • %d - Day of the month as a zero-padded number
  • %D - Short MM/DD/YY date, equivalent to %m/%d/%y
  • %e - Day of the month as a space-padded number
  • %F - Short YYYY-MM-DD date, equivalent to %Y-%m-%d
  • %c - Date and time representation
  • %C - Year divided by 100 and truncated to integer (00-99)
  • %I - Hour in 12h format (01-12)
  • %p - AM or PM designation
  • %H - Hour in 24h format (00-23)
  • %j - Day of the year (001-366)
  • %m - Month as a decimal number (01-12)
  • %M - Minute (00-59)
  • %n - New-line character ('\n')
  • %t - Horizontal-tab character ('\t')
  • %S - Second (00-61)
  • %T - ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S
  • %u - ISO 8601 weekday as number with Monday as 1 (1-7)
  • %w - Weekday as a decimal number with Sunday as 0 (0-6)
  • %y - Year, last two digits (00-99)
  • %Y - Year

* The specifiers marked with an asterisk (*) are locale-dependent.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 136 9/6/2023
1.0.0 158 9/6/2023
0.1.1 142 8/21/2023
0.1.0 162 7/28/2023