DateTimeLib - Subroutines to Compute Dates and Times since 1582-Oct-15

Supported by:

WinSize2 at SourceForge.net
Date Time Library

Date Time Library

Subroutines to Compute Dates and Times
since 1582-Oct-15

Actual version: 1.04


Download DateTimeLib

Other Programs by the same Author

Disclaimer


Date Time Library


Source code library with 25 routines for computation of date and time functions since the Gregorian Calendar was introduced on 1582-Oct-15. The programming language is Autohotkey which can be read and transfered easily by everyone who can read Pascal, Basic or Fortran.

Content:

  • add/subtract days&hh:mm:ss to/from a given date&time
  • with variables type Double: exact calculations down to 0.001 sec (1 msec)
  • considered all leap years (the anormalities every 4, 100 and 400 years)
  • considered the changes from summer time (Daylight Saving Time DST) to winter time and back
  • compute the start and end dates of DST for a given year
  • compute UTC (Universal Time = Greenwich Time) to local time; considered DST
  • compute weekdays
  • convert to Excel compatible date/time values
  • template for your own implementation
  • documentation inside the routines and in a handbook (English)
  • All routines are written in Autohotkey (AHK) which can be used nearly 1:1 in Pascal or other programming languages.
  • Examples to use these routines.
  • The description of call sequence with short description of the in- and output parameters you will find in the routine's headers.

The Routines in Detail:

Format H24MISS: String in the format "20090619012627": YYYYMMDDhhmmss


OutVar Name of Routine Formal Parameter Example
strDate := fDate_YYYYMMDD ( H24MISS ) "2005-06-19"
strTime := fDate_HHMMSS ( H24MISS ) "07:08:11"
strTime := fDate_HHMM ( H24MISS ) "07:08"
strTime := fTime_HHMMSS ( Seconds ) "321:08:05.123" / "321:08:05"
strTime := fTime_HHMMSS000 ( Seconds, iDecimals )
strTime := fTime_HHMM ( Seconds ) "321:08"
strTime := fTime_DDHHMMSS ( Seconds ) "13_09:08:05.123" / "13_09:08:05"
strTime := fTime_DDHHMM ( Seconds ) "13_09:08"
dblSeconds := fTime_Dbl_HHMMSS ( I:Hours, I:Min, I:Sec, I:Millisec ) Double: Seconds since midnight
Day1582 := fDate_AHK_Day1582 ( H24MISS ) DayNo since 1582
strDate := fDate_YYMMDD_strDate ( Year, Month, Day ) "2005-06-19"
Day1582 := fDate_YYMMDD_Day1582 ( Year, Month, Day ) DayNo since 1582
strDate := fDate_Day1582_strDate ( Day1582 )
intError := fDate_Day1582_YYMMDD ( I:Day1582, O:Year, O:Month, O:Day ) Err > 0: Day1582 incorrect + YY, MM, DD
may also be called as Sub without "intError := "
booLeapYear := fDate_LeapYear ( Year ) True = is Leap Year
False = no Leap Year
Days_in_Month := fDate_Days_in_Month ( Year, Month ) 28 (29 if leap year) / 30 / 31
Days_in_Month := fDate_Days_in_Month_Debug ( Called_By, Year, Month ) 28 (29) / 30 / 31
Output of calling routine if error occurred
Days_in_Month := fDate_Days_in_Month_Internal ( Year, Month ) Internal use only
Day_of_Week := fDate_Day_of_Week ( Year, Month, Day ) Out: 1=Sun .. 7=Sat
Name_of_Day := fDate_Day_Name ( Day_of_Week ) "Sunday", …
DayDiff_to_local := fDate_UTC_LocaleTimeReg ( ) difference UTC to local time [days] from Registry
Day1582_DST_Start := fDate_DST_Start ( Day1582 ) DST start in this year:
e.g. last Sunday in March, 02:00
1. Jan. <= Day1582 <= 31. Dec.
Day1582_DST_End := fDate_DST_End ( Day1582 ) DST end in this year:
e.g. last Sunday in October, 02:00
1. Jan. <= Day1582 <= 31. Dec.
DST_Active := fDate_DST_Active ( Day1582 ) 0 = Day1582 outside DST
1 = Day1582 between DST start and end
fDate_DST_StartEndSet (DST_Month_Start, DST_Month_End ) e.g. 3=March, 10=October