datetime.compare()

Compares to date, to the given optional resolution.

Returns -1 if date1 is before date2. Returns 1 if date1 is after date2. Returns 0 if equal

datetime.compare( date1, date2 [, datepart ] )

Returns: Number

Argument Description
date1
datetime, required

datetime object

date2
datetime, required

datetime object

datepart
string, optional

Precision of the comparison:

  • s (default): Precise to the second
  • n: Precise to the minute
  • h: Precise to the hour
  • d: Precise to the day
  • m: Precise to the month
  • yyyy: Precise to the year

Examples

There are currently no examples for this function

See also