DateRange Library

Provides functions to create various built-in DateRanges. All functions return Dates in UTC.

All datetime parameters are assumed to be UTC unless otherwise specified (e.g. by supplying a timezone object in the datetime constructor)

 

Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import DateRange

 

Functions

 

DateRange.date_range

Usage: DateRange.date_range(start, end)

Represents a time range from start to end dates.

  • Credit cost: 0
  • Parameters:
    • startdatetime Start of DateRange
    • enddatetime End of DateRange
  • Returns: DateRange



DateRange.this_second

Usage: DateRange.this_second()

Represents a time range from the start of this second until now.

  • Credit cost: 0
  • Parameters: None
  • Returns: DateRange



DateRange.one_second_from

Usage: DateRange.one_second_from(date_time)

Represents a time range of one second starting from date_time.

  • Credit cost: 0
  • Parameters:
    • date_timedatetime Start of DateRange
  • Returns: DateRange



DateRange.this_minute

Usage: DateRange.this_minute()

Represents a time range from the start of this minute until now.

  • Credit cost: 0
  • Parameters: None
  • Returns: DateRange



DateRange.one_minute_from

Usage: DateRange.one_minute_from(date_time)

Represents a time range of one minute starting from date_time.

  • Credit cost: 0
  • Parameters:
    • date_timedatetime Start of DateRange
  • Returns: DateRange



DateRange.this_hour

Usage: DateRange.this_hour()

Represents a time range from the start of this hour until now.

  • Credit cost: 0
  • Parameters: None
  • Returns: DateRange



DateRange.one_hour_from

Usage: DateRange.one_hour_from(date_time)

Represents a time range of one hour starting from date_time.

  • Credit cost: 0
  • Parameters:
    • date_timedatetime Start of DateRange
  • Returns: DateRange



DateRange.today

Usage: DateRange.today()

Represents a time range from the start of today (GMT time) until now.

  • Credit cost: 0
  • Parameters: None
  • Returns: DateRange



DateRange.one_day_from

Usage: DateRange.one_day_from(date_time)

Represents a time range of one day starting from date_time.

  • Credit cost: 0
  • Parameters:
    • date_timedatetime Start of DateRange
  • Returns: DateRange



DateRange.this_week

Usage: DateRange.this_week()

Represents a time range from the start of this week (GMT time) until now.

  • Credit cost: 0
  • Parameters: None
  • Returns: DateRange



DateRange.one_week_from

Usage: DateRange.one_week_from(date_time)

Represents a time range of one week starting from date_time.

  • Credit cost: 0
  • Parameters:
    • date_timedatetime Start of DateRange
  • Returns: DateRange



Sample Code

 

import DateRange

last_week = DateRange.this_week()
today = DateRange.today()
Have more questions? Submit a request

0 Comments

Article is closed for comments.