VOOZH about

URL: https://www.nuget.org/packages/TimeSpan.Xt/

⇱ NuGet Gallery | TimeSpan.Xt 0.6.1




TimeSpan.Xt 0.6.1

dotnet add package TimeSpan.Xt --version 0.6.1
 
 
NuGet\Install-Package TimeSpan.Xt -Version 0.6.1
 
 
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="TimeSpan.Xt" Version="0.6.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TimeSpan.Xt" Version="0.6.1" />
 
Directory.Packages.props
<PackageReference Include="TimeSpan.Xt" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TimeSpan.Xt --version 0.6.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TimeSpan.Xt, 0.6.1"
 
 
#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.
#:package TimeSpan.Xt@0.6.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TimeSpan.Xt&version=0.6.1
 
Install as a Cake Addin
#tool nuget:?package=TimeSpan.Xt&version=0.6.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

<h1 align="center"> <img width="90" src="logo.png" alt="timext"> </h1>

<p align="center"><h1 style="text-align: center;">TimeSpan.Xt</h1></p>

<p align="center"> <a href="https://github.com/JonasSchubert/TimeSpan.Xt/"><img src="https://img.shields.io/github/stars/JonasSchubert/TimeSpan.Xt.svg"/></a> <a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg"/></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg"/></a> </p>

First of all many thanks to Kizitonwose for the original idea and already awesome library!

This .NET Standard 2.0 library shall help to reduce code like

dotnet add package TimeSpan.Xt
var dayInMillis = 24 * 60 * 60 * 1000; // Represent a day in milliseconds
var inFiveDays = DateTime.Now + TimeSpan.FromDays(5);
var oneWeekAgo = DateTime.Now - TimeSpan.FromDays(7);

How to use

using TimeSpan.Xt;

var fiveCenturies = 5.Centuries(); // uses precise calculation: 1 Century == 36500 days
var fiveCenturiesAccumulated = 5.Centuries(true); // uses accumulated calculation: 1 Century == 36525 days
var tenDecades = 10.0.Decades(); // uses precise calculation: 1 Decade == 3650 days
var tenDecadesAccumulated = 10.0.Decades(true); // uses accumulated calculation: 1 Decade == 3652.5 days
var twoYears = 2.Years(); // uses precise calculation: 1 Year == 365 days
var twoYearsAccumulated = 2.Years(true); // uses accumulated calculation: 1 Year == 365.25 days
var oneWeek = 1.Weeks();
var threeDays = 3.Days();
var elevenHours = 11.Hours();
var sixMinutes = 6.Minutes();
var fiftySeconds = 50.Seconds();
var hundredMilliSeconds = 100.Milliseconds();
var fiveTicks = 5.Ticks();

var oneDayInMillis = 1.Days().InMilliseconds(); // Converts one day into milliseconds and returns the double value => 86400000
var twoWeeksInHours = 2.Weeks().InHours(); // Converts two weeks into hours and returns the double value => 336
var thirtyFiveDaysInWeeks = 35.Days().InWeeks(); // Converts 35 days into weeks and returns the double value => 5

var addition = 1.Days() + 12.Hours() + 30.Minutes();
var difference = 34.Minutes() - 240.Seconds();
var multiplication = 2.Weeks() * 2;
var division = 2.Minutes() / 2;

var inFiveDays = DateTime.Now + 5.Days();
var yesterday = DateTime.Now - 24.Hours();
var oneWeekAgo = DateTime.Now - 1.Weeks();

Since TimeSpan.Xt is directly interchangable with TimeSpan, it can be used in all places where you would normally use TimeSpan, e.g.

Task.Delay(5.Seconds())

Contributors

<img alt="JonasSchubert" src="https://avatars0.githubusercontent.com/u/21952813?v=4&s=117" width="117"/> <img alt="DenisBiondic" src="https://avatars1.githubusercontent.com/u/3341262?v=4&s=117" width="117"/>
Jonas Schubert Denis Biondic

License

TimeSpan.Xt is distributed under the MIT license. for details.

MIT License

Copyright (c) 2018-today JonasSchubert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TimeSpan.Xt:

Package Downloads
Snowflake.Data.Xt

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.1 500 5/7/2026
0.5.3 8,728 12/9/2024
0.4.0 7,968 2/21/2024