From 4aa3545b58ccda79863d8d2136904f2ff0995cfb Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Wed, 8 Nov 2017 22:52:34 -0800 Subject: [PATCH] Adding a date function --- src/SMAPI/Utilities/SDate.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index 2630731a..126673eb 100644 --- a/src/SMAPI/Utilities/SDate.cs +++ b/src/SMAPI/Utilities/SDate.cs @@ -95,6 +95,12 @@ namespace StardewModdingAPI.Utilities return $"{this.Day:00} {this.Season} Y{this.Year}"; } + /// This function will return the number of days since Year 1 Spring 0 for an arbitrary date + public static int TotalNumberOfDays(SDate date) + { + return (((date.Year - 1) * 112) + (date.GetSeasonIndex() * 28) + date.Day); + } + /**** ** IEquatable ****/