int_date package

Module contents

int_date.get_date_from_diff(i_date, delta_day)

calculate new int date with a start date and a diff (in days)

Parameters:
  • i_date – the starting date
  • delta_day – diff (in days), negative means past
Returns:

result date

int_date.get_date_from_int(int_date)

Convert a int date to a datetime instance

Parameters:int_date – int number which represents a date
Returns:datetime instance of the date
int_date.get_int_day_interval(int_left, int_right)

get interval (in day) between two int dates

Parameters:
  • int_left – first int date
  • int_right – second int date
Returns:

difference (in day), negative if second date is earlier than the first one.

int_date.in_date(day, dates)

check if day is in dates list or date

Parameters:
  • day – date
  • dates – list of dates or date
Returns:

true if in, otherwise false

int_date.in_month(day, months)

check if day is in months list or month

Parameters:
  • day – date
  • months – list of months or month
Returns:

true if in, otherwise false

int_date.in_year(day, years)

check if day is in years list or year

Parameters:
  • day – date
  • years – list of years or year
Returns:

true if in, otherwise false

int_date.to_int_date(the_day)

Convert a datetime object or a str/unicode to a int date

A int str could be one of the following format: 2015-01-30 2015/01/30

Parameters:the_day – datetime,date instance or string
Exception:ValueError if input could not be converted
Returns:int date
int_date.today()

Get the today of int date

Returns:int date of today