Name

date_mod — return a remainder from a timestamp

Synopsis

interval date_mod ( period,  
  daytime);  
text period ;
timestamp daytime ;
 
interval date_mod ( period,  
  daytime);  
text period ;
date daytime ;
 
interval date_mod ( period,  
  daytime);  
text period ;
interval daytime ;
 
interval date_mod ( period,  
  daytime);  
text period ;
time daytime ;
 

Input

period

A string indicating a unit of time. The values allowed are the same as those allowed for the field parameter of the PostgreSQL date_trunc function. At the time of this writing these are:

  • microseconds

  • milliseconds

  • second

  • minute

  • hour

  • day

  • week

  • month

  • quarter

  • year

  • decade

  • century

  • millennium

daytime

The timestamp or date from which to return the remainder.

Description

A function which returns the interval remaining from the given daytime value after the last whole period. I.e. date_mod('hour', '1941-12-7 07:45:00'::timestamp) returns the interval following the last hour, 45:00 minutes.

date_mod() operates on timestamp and date values in a fashion conceptually similar to the numeric modulo function, which returns the remainder after division.


Page generated: 2016-07-22T23:08:45-04:00.