add a number of days and return a new instance of IsoDate (days may be negative)
add a number of work day and return a new instance of IsoDate (days must be positive)
return a formatted string in ISO8601 syntax
Parameters: |
|
---|---|
Returns: | string according to the isoformat |
return the day of the week as number from 1..7 (ISO) or as string when using fmt=’string’
return the weekday name
depending on mode, the method return ‘MO’..’SU’ for mode ‘en’ or ‘Mon’...’Sun’ for mode ‘short’ or ‘Monday’...’Sunday’ for mode ‘long’ and the language will be detemrined by the country attribute of the IsoDate instance currently ‘DE’, ‘IT’, ‘AT’, ‘US’ :param mode: ‘en’ | ‘short’ | ‘long’ :return: weekday as string
return day of the year
type of day
Returns: | ‘workday’ | ‘holiday’ | ‘weekend’ |
---|
days since a second IsoDate instance
days until a second IsoDate instance
initialize an IsoDate instance from an ISO string
Parameters: |
|
---|---|
Returns: | IsoDate instance according to data from the ISO string |
Raise : | ValueError if any of the elements have invalid values |
return a formatted string in ISO8601 syntax
Returns: | ISO8601 long form (with separators) string according to the isoformat |
---|
return the corresponding julian date for the IsoDate instance
Returns: | number with the julian date |
---|
parse an ISO8601 string and return a dictionary with the results
Parameters: |
|
---|---|
Returns: | a dictionary with the parsing results |
try to mimic a very simple time estimation model
Parameters: |
|
---|---|
Returns: | a new IsoDate instance with the calculated end date |
replace certain parts of the date and return a new IsoDate instance
determine the week of the year
Returns: | iso calendar week (1..52 or 53 for leap years) |
---|
helper property to get the date tuple (year, month, day) for easter sunday
Returns: | date tuple for easter sunday |
---|
just a helper method to get the month name according to the country attribute of the IsoYear instance :param the_month: the month from 1..12 :param mode: ‘short’ | ‘long’ :return: string with the month name
return the list of holidays for the year
Returns: | list of holiday entries |
---|
check if a given day in a given month is a holiday or a weekend day :param month: integer from 1..12 for the month :param day: integer from 1..DAYS_IN_MONTH for the day :return: True if the day is a holiday
get the list of all iso calendar weeks for the year
this property yields the list of calendar weeks (ISO weeks starting with a monday (weekday number 1) for the year. Each entry is a dictionary with the key ‘no’ holing the week no, the key ‘start’ containing a tuple of (year, month, day). As ISO weeks starts on a monday, the weekday of every date is always a monday.
Returns: | array of 52 or 52 tuples |
---|
check if a year is a leap year
Returns: | boolean True or False |
---|
returns the primo (first workday of the month) for a given month :param month: the month from 1..12 :return: a new instance of IsoDate with the primo for the month
returns the ultimo (last workday of the month) for a given month :param month: the month from 1..12 :return: a new instance of IsoDate with the ultimo for the month
return the number of weeks for this year
Returns: | integer 52 or 53 |
---|
return the number of working days in the given month :param month: integer 1..12 :return: int with the number of workdays
This module provides utility functions that are also useful for external consumption.
add days to a date, days_to_add can be negative also :param year: four-digit year :param month: month form 1..12 :param day: day from 1..DAYS_IN_MONTH :param days_to_add: integer days to add :returns: ymd tuple
calculate the list of holidays for a year in a location
Parameters: |
|
---|---|
Returns: | list of holiday tuples (name, date tuple) |
calculate the base date for a variable holiday
Parameters: |
|
---|---|
Returns: | ymd tuple |
calculate the day of the week
day_of_week either returns a number from 1..7 or a string from MO..SU depending on the fmt keyword parameter (numbering according to ISO8601)
Parameters: |
|
---|---|
Returns: | weekday as integer or string |
calculate the day number within a year (1..365/366)
Parameters: |
|
---|
calculate the number of days in a given month
Parameters: |
|
---|---|
Returns: | integer with days in month |
helper method to get the number of days in a year
Parameters: | year – four digit year |
---|---|
Returns: | 365 or 366 |
convert day within a given year to a ymd tuple
Parameters: |
|
---|---|
Returns: | ymd tuple |
calculate schöyter easter sunday day number
Parameters: | year – the four digit year |
---|
calculate easter sunday for a given year
Parameters: | year – four-digit year |
---|---|
Returns: | ymd tuple for easter sunday |
retrieve name of the month in various formats
Parameters: |
|
---|---|
Returns: | string with the month name |
convert ymd tuple to julian day number
Parameters: |
|
---|
check if year is a leap year
Parameters: | year – four digit year |
---|---|
Returns: | True or False |
check if a time is valid (within 00:00:00 to 24:00:00)
Parameters: |
|
---|
parse an ISO8601 date string :param input_string: ISO8601 date string :returns: dictionary with parsing results
return a formatted string in ISO8601 syntax
Returns: | ISO8601 long form (with separators) string according to the isoformat |
---|
main wrapper method for the ISO8601 date/time parser
Parameters: |
|
---|---|
Returns: | dictionary with the parsing results |
split an ISO8601 date/time string in date, time, tz parts
basic logic: - if it has a ‘T’ in it, it is a date and time input - if it has [‘Z’, ‘z’, ‘+’, ‘-‘] in it, it has a timezone information
Parameters: |
|
---|---|
Returns: | tuple with datepart, timepart, tzpart |
parse an ISO8601 time string
Parameters: | input_string – ISO8601 time string |
---|---|
Returns: | dictionary with parsing results |
parse ISO8601 time zone information
time zone info is ‘Z’ or (+|-)hh[[:]mm] time zone is checked against a list of valid time zones (see definitions module) :param input_string: ISO8601 timezone string :returns: dictionary with parsing results
convert julian date number to ymd tuple :param julian_number: the julian date to convert
convert julian date to modified julian date
load the day list (weekend, holiday or normal day) for a given year and a given location
Parameters: |
|
---|---|
Returns: | list of day entries for every day of the year (‘’|’W’|’H’) |
convert modified julian date to julian date
parse a fixed holiday that always occurs on the same month and day
Parameters: |
|
---|---|
Returns: | tuple with date(s) of the holiday |
parse a holiday definition and return the date
Parameters: |
|
---|
parse a variable holiday
Parameters: |
|
---|---|
Returns: | tuple with date(s) of the holiday |
retrieve name of the week day in various formats
Parameters: |
|
---|---|
Returns: | string with the month name |
calculate the ISO week number (1..53) for a given date
Parameters: |
|
---|---|
Returns: | integer ISO week number |
calculate the beginning of a ISO week number
Parameters: |
|
---|
calculate the number of week in a given year :param year: four-digit year :returns: integer 1..53