Skip to content

dimitrietataru/ace-csharp-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C# time

build release NuGet

What is AceCSharp.Time

It's a library, that exposes DI-ready and mockable implementation of current date and time, or date and time with offset.

Usage

IDateTimeProvider dateTimeProvider = new DateTimeProvider();

DateTime moment = dateTimeProvider.Now();
DateTime momentInUtc = dateTimeProvider.UtcNow();

DateTimeOffset momentWithOffset = dateTimeProvider.NowOffset();
DateTimeOffset momentWithZeroOffset = dateTimeProvider.UtcNowOffset();
ISystemTime systemTime = new SystemTime();

DateTime moment = systemTime.Now();
DateTime momentInUtc = systemTime.UtcNow();

License

AceCSharp.Time is Copyright © 2022 Dimitrie Tataru and other contributors under the MIT license.