The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Time::Tradedates - Perl extension for last and first trade dates in a month


  use Time::Tradedates;
  $return = &getNumDays($edate);      # Pass in an epoch (UNIX) date.
                                      # See timelocal and localtime functions
                                      # Returns the number of days in the month
  $return = &lastTradeDay($mon,$year,$integer);
                                      # Pass in Perl Month (i.e. Jan=0), 4 digit year
                                      # and an integer.  0 = last trade day, -1 = LTD-1
                                      # At this time only 0 and -1 are supported other
                                      # Values will return 0
                                      # Returns the last trade day or LTD-1
  $return = &firstTradeDay($mon,$year);
                                      # Pass in Perl Month (i.e. Jan=0) and 4 digit year
                                      # Returns the first trade day


This module is for companies that need to do processing only on the last trade date of the month and/or N number of days before the last trade date. It will also be extended to provide the first trade date of the month. It is Leap Year sensitive!

It should be used to check the current date and find out if that date is one of the days you specified for processing. If not, simply exit.


David S. Spizzirro (


Time::Local, localtime(), timelocal()