TimeHelper

Ecng.Common

Provides various helper methods and properties for working with dates, times, and time offsets.

Eigenschaften

Now
public static DateTime Now { get; }
value = TimeHelper.Now

Gets the current time including the configured offset.

NowOffset
public static TimeSpan NowOffset { get; set; }
value = TimeHelper.NowOffset
TimeHelper.NowOffset = value

Gets or sets the offset applied to the current time when retrieving Now.

NowWithOffset
public static DateTimeOffset NowWithOffset { get; }
value = TimeHelper.NowWithOffset

Gets the current time as a DateTimeOffset including the local offset.

TimeZoneOffset
public static TimeSpan TimeZoneOffset { get; set; }
value = TimeHelper.TimeZoneOffset
TimeHelper.TimeZoneOffset = value

Gets or sets the time zone offset used for calculations.

UnixNowMls
public static double UnixNowMls { get; }
value = TimeHelper.UnixNowMls

Gets the current Unix time in milliseconds.

UnixNowS
public static double UnixNowS { get; }
value = TimeHelper.UnixNowS

Gets the current Unix time in seconds.

Methoden

AddMicroseconds
public static TimeSpan AddMicroseconds(TimeSpan t, long microseconds)
result = TimeHelper.AddMicroseconds(t, microseconds)

Adds the specified number of microseconds to a TimeSpan.

AddMicroseconds
public static DateTime AddMicroseconds(DateTime dt, long microseconds)
result = TimeHelper.AddMicroseconds(dt, microseconds)

Adds the specified number of microseconds to a DateTime.

AddMicroseconds
public static DateTimeOffset AddMicroseconds(DateTimeOffset dto, long microseconds)
result = TimeHelper.AddMicroseconds(dto, microseconds)

Adds the specified number of microseconds to a DateTimeOffset.

AddNanoseconds
public static DateTime AddNanoseconds(DateTime dt, long nanoseconds)
result = TimeHelper.AddNanoseconds(dt, nanoseconds)

Adds the specified number of nanoseconds to a DateTime.

AddNanoseconds
public static DateTimeOffset AddNanoseconds(DateTimeOffset dto, long nanoseconds)
result = TimeHelper.AddNanoseconds(dto, nanoseconds)

Adds the specified number of nanoseconds to a DateTimeOffset.

AddNanoseconds
public static TimeSpan AddNanoseconds(TimeSpan t, long nanoseconds)
result = TimeHelper.AddNanoseconds(t, nanoseconds)

Adds the specified number of nanoseconds to a TimeSpan.

ApplyChina
public static DateTimeOffset ApplyChina(DateTime dt)
result = TimeHelper.ApplyChina(dt)

Creates a DateTimeOffset from a DateTime in China Standard Time.

ApplyEst
public static DateTimeOffset ApplyEst(DateTime dt)
result = TimeHelper.ApplyEst(dt)

Creates a DateTimeOffset from a DateTime in Eastern Standard Time.

ApplyLocal
public static DateTimeOffset ApplyLocal(DateTime dt)
result = TimeHelper.ApplyLocal(dt)

Creates a DateTimeOffset from a DateTime using the local time zone.

ApplyMoscow
public static DateTimeOffset ApplyMoscow(DateTime dt)
result = TimeHelper.ApplyMoscow(dt)

Creates a DateTimeOffset from a DateTime in Russian Standard Time (Moscow).

ApplyTimeZone
public static DateTimeOffset ApplyTimeZone(DateTime dt, TimeZoneInfo zone)
result = TimeHelper.ApplyTimeZone(dt, zone)

Creates a DateTimeOffset from a DateTime in the specified time zone.

ApplyTimeZone
public static DateTimeOffset ApplyTimeZone(DateTime dt, TimeSpan offset)
result = TimeHelper.ApplyTimeZone(dt, offset)

Creates a DateTimeOffset from a DateTime with the specified offset.

ApplyUtc
public static DateTimeOffset ApplyUtc(DateTime dt)
result = TimeHelper.ApplyUtc(dt)

Creates a DateTimeOffset from a DateTime using UTC.

ChangeKind
public static DateTime ChangeKind(DateTime date, DateTimeKind kind)
result = TimeHelper.ChangeKind(date, kind)

Changes the DateTimeKind of a DateTime.

Convert
public static DateTimeOffset Convert(DateTimeOffset dto, TimeZoneInfo zone)
result = TimeHelper.Convert(dto, zone)

Converts the specified DateTimeOffset to the provided time zone.

dto
The DateTimeOffset to convert.
zone
The target TimeZoneInfo.

Rückgabe: A DateTimeOffset in the specified time zone.

ConvertToChina
public static DateTimeOffset ConvertToChina(DateTimeOffset dto)
result = TimeHelper.ConvertToChina(dto)

Converts a DateTimeOffset to China Standard Time zone.

ConvertToEst
public static DateTimeOffset ConvertToEst(DateTimeOffset dto)
result = TimeHelper.ConvertToEst(dto)

Converts the specified DateTimeOffset to Eastern Standard Time.

dto
The DateTimeOffset to convert.

Rückgabe: A new DateTimeOffset in Eastern Standard Time.

ConvertToMoscow
public static DateTimeOffset ConvertToMoscow(DateTimeOffset dto)
result = TimeHelper.ConvertToMoscow(dto)

Converts the specified DateTimeOffset to Moscow Time.

dto
The DateTimeOffset to convert.

Rückgabe: A new DateTimeOffset in Moscow Time.

ConvertToUtc
public static DateTimeOffset ConvertToUtc(DateTimeOffset dto)
result = TimeHelper.ConvertToUtc(dto)

Converts the specified DateTimeOffset to UTC.

dto
The DateTimeOffset to convert.

Rückgabe: A new DateTimeOffset in UTC.

DaysInMonth
public static int DaysInMonth(DateTime date)
result = TimeHelper.DaysInMonth(date)

Gets the number of days in the month of the given DateTime.

EndOfDay
public static DateTime EndOfDay(DateTime dt)
result = TimeHelper.EndOfDay(dt)

Gets the end of the day for the specified DateTime, just before midnight.

EndOfDay
public static DateTimeOffset EndOfDay(DateTimeOffset dto)
result = TimeHelper.EndOfDay(dto)

Gets the end of the day for the specified DateTimeOffset, just before midnight.

FromDateTime
public static string FromDateTime(DateTime dt, string format, CultureInfo ci)
result = TimeHelper.FromDateTime(dt, format, ci)

Formats a DateTime to a string using the provided format.

FromDateTimeOffset
public static string FromDateTimeOffset(DateTimeOffset dto, string format, CultureInfo ci)
result = TimeHelper.FromDateTimeOffset(dto, format, ci)

Formats a DateTimeOffset to a string using the provided format.

FromIso8601
public static DateTime FromIso8601(string str, IFormatProvider provider)
result = TimeHelper.FromIso8601(str, provider)

Parses the specified string as an ISO8601 date/time.

str
The string to parse.
provider
An optional IFormatProvider.

Rückgabe: A DateTime parsed from the string, in UTC.

FromTimeSpan
public static string FromTimeSpan(TimeSpan ts, string format, CultureInfo ci)
result = TimeHelper.FromTimeSpan(ts, format, ci)

Formats a TimeSpan to a string using the provided format.

FromUnix
public static DateTime FromUnix(double time, bool isSeconds)
result = TimeHelper.FromUnix(time, isSeconds)

Creates a DateTime from a Unix time in seconds or milliseconds.

time
The Unix time to convert.
isSeconds
If set to true, interprets time as seconds; otherwise milliseconds.

Rückgabe: A DateTime in UTC.

FromUnix
public static DateTime FromUnix(long time, bool isSeconds)
result = TimeHelper.FromUnix(time, isSeconds)

Creates a DateTime from a Unix time in seconds or milliseconds.

time
The Unix time to convert.
isSeconds
If set to true, interprets time as seconds; otherwise milliseconds.

Rückgabe: A DateTime in UTC.

FromUnixAuto
public static DateTime FromUnixAuto(long ts)
result = TimeHelper.FromUnixAuto(ts)

Creates a DateTime from a Unix timestamp with auto-detection of unit (seconds, milliseconds, 1/10000 seconds, or microseconds).

ts
The Unix timestamp to convert.

Rückgabe: A DateTime in UTC.

FromUnixMcs
public static DateTime FromUnixMcs(long mcs)
result = TimeHelper.FromUnixMcs(mcs)

Creates a DateTime from Microseconds since GregorianStart.

mcs
Microseconds to convert.

Rückgabe: A DateTime in UTC.

FromUnixMcs
public static DateTime FromUnixMcs(double mcs)
result = TimeHelper.FromUnixMcs(mcs)

Creates a DateTime from Microseconds since GregorianStart.

mcs
Microseconds to convert.

Rückgabe: A DateTime in UTC.

GetIso8601WeekOfYear
public static int GetIso8601WeekOfYear(DateTime time, CultureInfo ci)
result = TimeHelper.GetIso8601WeekOfYear(time, ci)

Calculates the ISO8601 week number of the specified date.

time
The DateTime to evaluate.
ci
An optional CultureInfo.

Rückgabe: The ISO8601 week of the year.

GetLunarPhase
public static LunarPhases GetLunarPhase(DateTime date)
result = TimeHelper.GetLunarPhase(date)

Determines the lunar phase for the specified date.

date
The DateTime for which to determine the phase.

Rückgabe: A LunarPhases value representing the phase of the moon.

GetMicroseconds
public static int GetMicroseconds(TimeSpan ts)
result = TimeHelper.GetMicroseconds(ts)

Gets the microseconds component from a TimeSpan.

GetMicroseconds
public static int GetMicroseconds(DateTime dt)
result = TimeHelper.GetMicroseconds(dt)

Gets the microseconds component from a DateTime.

GetNanoseconds
public static int GetNanoseconds(long ticks)
result = TimeHelper.GetNanoseconds(ticks)

Gets the nanoseconds component from the specified number of ticks.

GetNanoseconds
public static int GetNanoseconds(DateTime dt)
result = TimeHelper.GetNanoseconds(dt)

Gets the nanoseconds component from a DateTime.

GetNanoseconds
public static int GetNanoseconds(TimeSpan ts)
result = TimeHelper.GetNanoseconds(ts)

Gets the nanoseconds component from a TimeSpan.

GetUnixDiff
public static TimeSpan GetUnixDiff(DateTime time)
result = TimeHelper.GetUnixDiff(time)

Gets the difference between the specified DateTime and the GregorianStart.

time
The DateTime to evaluate.

Rückgabe: A TimeSpan representing the difference.

IsDateOrTime
public static bool IsDateOrTime(Type type)
result = TimeHelper.IsDateOrTime(type)

Checks if the given Type is a date or time type.

type
The Type to check.

Rückgabe: True if the type is a date/time or TimeSpan; otherwise false.

IsDateTime
public static bool IsDateTime(Type type)
result = TimeHelper.IsDateTime(type)

Checks if the given Type is a date/time type.

type
The Type to check.

Rückgabe: True if the type is a DateTime or DateTimeOffset; otherwise false.

IsWeekday
public static bool IsWeekday(DayOfWeek dow)
result = TimeHelper.IsWeekday(dow)

Checks if the given DayOfWeek represents a weekday (Monday through Friday).

dow
The DayOfWeek.

Rückgabe: True if it is a weekday; otherwise false.

IsWeekday
public static bool IsWeekday(DateTimeOffset date)
result = TimeHelper.IsWeekday(date)

Checks if the given DateTimeOffset falls on a weekday (Monday through Friday).

date
The DateTimeOffset to check.

Rückgabe: True if it is a weekday; otherwise false.

IsWeekday
public static bool IsWeekday(DateTime date)
result = TimeHelper.IsWeekday(date)

Checks if the given DateTime falls on a weekday (Monday through Friday).

date
The DateTime to check.

Rückgabe: True if it is a weekday; otherwise false.

IsWeekend
public static bool IsWeekend(DayOfWeek dow)
result = TimeHelper.IsWeekend(dow)

Checks if the given DayOfWeek represents a weekend (Saturday or Sunday).

dow
The DayOfWeek.

Rückgabe: True if it is a weekend; otherwise false.

IsWeekend
public static bool IsWeekend(DateTimeOffset date)
result = TimeHelper.IsWeekend(date)

Checks if the given DateTimeOffset falls on a weekend (Saturday or Sunday).

date
The DateTimeOffset to check.

Rückgabe: True if it is a weekend; otherwise false.

IsWeekend
public static bool IsWeekend(DateTime date)
result = TimeHelper.IsWeekend(date)

Checks if the given DateTime falls on a weekend (Saturday or Sunday).

date
The DateTime to check.

Rückgabe: True if it is a weekend; otherwise false.

MicrosecondsToTicks
public static long MicrosecondsToTicks(long mcs)
result = TimeHelper.MicrosecondsToTicks(mcs)

Converts microseconds to ticks.

NanosecondsToTicks
public static long NanosecondsToTicks(long nanoseconds)
result = TimeHelper.NanosecondsToTicks(nanoseconds)

Converts nanoseconds to ticks.

Range
public static IEnumerable<DateTime> Range(DateTime from, DateTime to, TimeSpan interval)
result = TimeHelper.Range(from, to, interval)

Generates a sequence of DateTime values from a start to an end with a given interval.

from
Start date.
to
End date.
interval
The interval between generated dates.

Rückgabe: An enumerable of dates.

StartOfWeek
public static DateTime StartOfWeek(DateTime date, DayOfWeek startOfWeek)
result = TimeHelper.StartOfWeek(date, startOfWeek)

Gets the start of the week for the specified DateTime, based on a chosen DayOfWeek.

SyncMarketTime
public static void SyncMarketTime(int timeout)
TimeHelper.SyncMarketTime(timeout)

Synchronizes the current offset by comparing local time with an NTP server.

timeout
The synchronization timeout in milliseconds.
TicksToMicroseconds
public static long TicksToMicroseconds(long ticks)
result = TimeHelper.TicksToMicroseconds(ticks)

Converts ticks to microseconds.

TicksToNanoseconds
public static long TicksToNanoseconds(long ticks)
result = TimeHelper.TicksToNanoseconds(ticks)

Converts ticks to nanoseconds.

To
public static DateTime To(DateTime time, TimeZoneInfo source, TimeZoneInfo destination)
result = TimeHelper.To(time, source, destination)

Converts a DateTime between time zones.

ToDateTime
public static DateTime ToDateTime(string value, string format, CultureInfo ci)
result = TimeHelper.ToDateTime(value, format, ci)

Converts a string to a DateTime using the provided format.

ToDateTimeOffset
public static DateTimeOffset ToDateTimeOffset(string value, string format, CultureInfo ci)
result = TimeHelper.ToDateTimeOffset(value, format, ci)

Converts a string to a DateTimeOffset using the provided format.

ToDateTimeOffset
public static DateTimeOffset ToDateTimeOffset(DateTime date, TimeZoneInfo zone)
result = TimeHelper.ToDateTimeOffset(date, zone)

Converts a DateTime and a time zone to a DateTimeOffset.

ToDateTimeOffset
public static DateTimeOffset ToDateTimeOffset(DateTime date, TimeSpan offset)
result = TimeHelper.ToDateTimeOffset(date, offset)

Converts a DateTime and a specific offset to a DateTimeOffset.

ToIso8601
public static string ToIso8601(DateTime dt, IFormatProvider provider)
result = TimeHelper.ToIso8601(dt, provider)

Formats the specified DateTime as an ISO8601 string.

dt
The DateTime to format.
provider
An optional IFormatProvider.

Rückgabe: An ISO8601-formatted string.

ToJulianDate
public static double ToJulianDate(DateTime date)
result = TimeHelper.ToJulianDate(date)

Converts the specified DateTime to a Julian date.

date
The DateTime to convert.

Rückgabe: A double representing the Julian date.

ToLocalTime
public static DateTime ToLocalTime(DateTimeOffset dto, TimeZoneInfo zone)
result = TimeHelper.ToLocalTime(dto, zone)

Converts a DateTimeOffset to a DateTime in the specified time zone.

ToNanoseconds
public static long ToNanoseconds(TimeSpan ts)
result = TimeHelper.ToNanoseconds(ts)

Converts a TimeSpan to the total number of nanoseconds.

TotalCenturies
public static double TotalCenturies(TimeSpan value)
result = TimeHelper.TotalCenturies(value)

Returns total centuries in the specified TimeSpan.

TotalMilleniums
public static double TotalMilleniums(TimeSpan value)
result = TimeHelper.TotalMilleniums(value)

Returns total millenniums in the specified TimeSpan.

TotalMonths
public static double TotalMonths(TimeSpan value)
result = TimeHelper.TotalMonths(value)

Returns total months in the specified TimeSpan.

TotalWeeks
public static double TotalWeeks(TimeSpan value)
result = TimeHelper.TotalWeeks(value)

Returns total weeks in the specified TimeSpan.

TotalYears
public static double TotalYears(TimeSpan value)
result = TimeHelper.TotalYears(value)

Returns total years in the specified TimeSpan.

ToTimeSpan
public static TimeSpan ToTimeSpan(string value, string format, CultureInfo ci)
result = TimeHelper.ToTimeSpan(value, format, ci)

Converts a string to a TimeSpan using the provided format.

ToUnix
public static double ToUnix(DateTimeOffset time, bool isSeconds)
result = TimeHelper.ToUnix(time, isSeconds)

Converts the specified DateTimeOffset to Unix time in seconds or milliseconds.

time
The DateTimeOffset to convert.
isSeconds
If set to true, returns seconds; otherwise milliseconds.

Rückgabe: A double representing the Unix time.

ToUnix
public static double ToUnix(DateTime time, bool isSeconds)
result = TimeHelper.ToUnix(time, isSeconds)

Converts the specified DateTime to Unix time in seconds or milliseconds.

time
The DateTime to convert.
isSeconds
If set to true, returns seconds; otherwise milliseconds.

Rückgabe: A double representing the Unix time.

ToUnixMcs
public static long ToUnixMcs(DateTime time)
result = TimeHelper.ToUnixMcs(time)

Converts the specified DateTime to Unix Microseconds since GregorianStart.

time
The DateTime to convert.

Rückgabe: A long representing the Unix time in microseconds.

Truncate
public static DateTimeOffset Truncate(DateTimeOffset time, TimeSpan timeSpan)
result = TimeHelper.Truncate(time, timeSpan)

Truncates the specified DateTimeOffset to the given TimeSpan.

time
The DateTimeOffset to truncate.
timeSpan
The TimeSpan precision.

Rückgabe: The truncated DateTimeOffset.

Truncate
public static DateTime Truncate(DateTime dateTime, TimeSpan timeSpan)
result = TimeHelper.Truncate(dateTime, timeSpan)

Truncates a DateTime to the specified time span precision.

Truncate
public static DateTimeOffset Truncate(DateTimeOffset time, long precision)
result = TimeHelper.Truncate(time, precision)

Truncates the specified DateTimeOffset to the given precision in ticks.

time
The DateTimeOffset to truncate.
precision
The precision in ticks.

Rückgabe: The truncated DateTimeOffset.

Truncate
public static DateTime Truncate(DateTime time, long precision)
result = TimeHelper.Truncate(time, precision)

Truncates a DateTime to the specified ticks precision.

Truncate
public static TimeSpan Truncate(TimeSpan dateTime, TimeSpan timeSpan)
result = TimeHelper.Truncate(dateTime, timeSpan)

Truncates a TimeSpan to the specified time span precision.

Truncate
public static TimeSpan Truncate(TimeSpan time, long precision)
result = TimeHelper.Truncate(time, precision)

Truncates a TimeSpan to the specified ticks precision.

TryFromUnix
public static DateTime? TryFromUnix(double time, bool isSeconds)
result = TimeHelper.TryFromUnix(time, isSeconds)

Tries to create a DateTime from a Unix time in seconds or milliseconds. Returns null if time is near zero.

time
The Unix time to convert.
isSeconds
If set to true, interprets time as seconds; otherwise milliseconds.

Rückgabe: A DateTime in UTC, or null if near zero.

TryFromUnix
public static DateTime? TryFromUnix(long time, bool isSeconds)
result = TimeHelper.TryFromUnix(time, isSeconds)

Tries to create a DateTime from a Unix time in seconds or milliseconds. Returns null if time is 0.

time
The Unix time to convert.
isSeconds
If set to true, interprets time as seconds; otherwise milliseconds.

Rückgabe: A DateTime in UTC, or null if 0.

TryToDateTime
public static DateTime? TryToDateTime(string value, string format, CultureInfo ci)
result = TimeHelper.TryToDateTime(value, format, ci)

Attempts to convert a string to a DateTime using the provided format.

TryToDateTimeOffset
public static DateTimeOffset? TryToDateTimeOffset(string value, string format, CultureInfo ci)
result = TimeHelper.TryToDateTimeOffset(value, format, ci)

Attempts to convert a string to a DateTimeOffset using the provided format.

TryToTimeSpan
public static TimeSpan? TryToTimeSpan(string value, string format, CultureInfo ci)
result = TimeHelper.TryToTimeSpan(value, format, ci)

Attempts to convert a string to a TimeSpan using the provided format.

UtcKind
public static DateTime UtcKind(DateTime date)
result = TimeHelper.UtcKind(date)

Converts a DateTime to UTC kind.

Felder

China
public static readonly TimeZoneInfo China
value = TimeHelper.China

Represents the China Standard Time zone.

Cst
public static readonly TimeZoneInfo Cst
value = TimeHelper.Cst

Represents the Central Standard Time zone.

Day
public static readonly TimeSpan Day
value = TimeHelper.Day

A TimeSpan of one day.

Est
public static readonly TimeZoneInfo Est
value = TimeHelper.Est

Represents the Eastern Standard Time zone.

Fle
public static readonly TimeZoneInfo Fle
value = TimeHelper.Fle

Represents the FLE (Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius) Standard Time zone.

Gmt
public static readonly TimeZoneInfo Gmt
value = TimeHelper.Gmt

Represents the GMT Standard Time zone.

GregorianStart
public static readonly DateTime GregorianStart
value = TimeHelper.GregorianStart

Represents a reference start date (1/1/1970, UTC).

Hour
public static readonly TimeSpan Hour
value = TimeHelper.Hour

A TimeSpan of one hour.

Korea
public static readonly TimeZoneInfo Korea
value = TimeHelper.Korea

Represents the Korea Standard Time zone.

LessOneDay
public static readonly TimeSpan LessOneDay
value = TimeHelper.LessOneDay

A TimeSpan that is one tick less than a day.

Minute1
public static readonly TimeSpan Minute1
value = TimeHelper.Minute1

A TimeSpan of one minute.

Minute10
public static readonly TimeSpan Minute10
value = TimeHelper.Minute10

A TimeSpan of ten minutes.

Minute15
public static readonly TimeSpan Minute15
value = TimeHelper.Minute15

A TimeSpan of fifteen minutes.

Minute5
public static readonly TimeSpan Minute5
value = TimeHelper.Minute5

A TimeSpan of five minutes.

Month
public static readonly TimeSpan Month
value = TimeHelper.Month

A TimeSpan of one month (30 days).

Moscow
public static readonly TimeZoneInfo Moscow
value = TimeHelper.Moscow

Represents the Russian Standard Time zone (Moscow).

NanosecondsPerTick
public const long NanosecondsPerTick
value = TimeHelper.NanosecondsPerTick

Represents the number of nanoseconds in 1 tick.

TicksPerCentury
public const long TicksPerCentury
value = TimeHelper.TicksPerCentury

Represents the number of ticks in 1 century.

TicksPerMicrosecond
public const long TicksPerMicrosecond
value = TimeHelper.TicksPerMicrosecond

Represents the number of ticks in 1 microsecond.

TicksPerMillenium
public const long TicksPerMillenium
value = TimeHelper.TicksPerMillenium

Represents the number of ticks in 1 millenium.

TicksPerMonth
public const long TicksPerMonth
value = TimeHelper.TicksPerMonth

Represents the number of ticks in 1 month.

TicksPerNanosecond
public const double TicksPerNanosecond
value = TimeHelper.TicksPerNanosecond

Represents the number of ticks in 1 nanosecond.

TicksPerWeek
public const long TicksPerWeek
value = TimeHelper.TicksPerWeek

Represents the number of ticks in 1 week.

TicksPerYear
public const long TicksPerYear
value = TimeHelper.TicksPerYear

Represents the number of ticks in 1 year.

Tokyo
public static readonly TimeZoneInfo Tokyo
value = TimeHelper.Tokyo

Represents the Tokyo Standard Time zone.

Tunisia
public static readonly TimeZoneInfo Tunisia
value = TimeHelper.Tunisia

Represents the West Central Africa Standard Time zone (Tunisia).

Week
public static readonly TimeSpan Week
value = TimeHelper.Week

A TimeSpan of one week (7 days).

Year
public static readonly TimeSpan Year
value = TimeHelper.Year

A TimeSpan of one year (365 days).