# datetime_diff()datetime_diff()

Calcola la differenza calendarian tra due valori DateTime .Calculates calendarian difference between two datetime values.

## SintassiSyntax

datetime_diff(periodo , datetime_1 , datetime_2)datetime_diff(period,datetime_1,datetime_2)

## ArgomentiArguments

Possibili valori del periodo:Possible values of period:

• YearYear
• QuarterQuarter
• MonthMonth
• SettimanaWeek
• GiornoDay
• HourHour
• MinutoMinute
• SecondSecond
• MillisecondMillisecond
• MicrosecondiMicrosecond
• NanosecondoNanosecond

## RestituisceReturns

Integer, che rappresenta la quantità di periods nel risultato della sottrazione ( datetime_1 - datetime_2 ).An integer, which represents amount of periods in the result of subtraction (datetime_1 - datetime_2).

## EsempioExamples

print
year = datetime_diff('year',datetime(2017-01-01),datetime(2000-12-31)),
quarter = datetime_diff('quarter',datetime(2017-07-01),datetime(2017-03-30)),
month = datetime_diff('month',datetime(2017-01-01),datetime(2015-12-30)),
week = datetime_diff('week',datetime(2017-10-29 00:00),datetime(2017-09-30 23:59)),
day = datetime_diff('day',datetime(2017-10-29 00:00),datetime(2017-09-30 23:59)),
hour = datetime_diff('hour',datetime(2017-10-31 01:00),datetime(2017-10-30 23:59)),
minute = datetime_diff('minute',datetime(2017-10-30 23:05:01),datetime(2017-10-30 23:00:59)),
second = datetime_diff('second',datetime(2017-10-30 23:00:10.100),datetime(2017-10-30 23:00:00.900)),
millisecond = datetime_diff('millisecond',datetime(2017-10-30 23:00:00.200100),datetime(2017-10-30 23:00:00.100900)),
microsecond = datetime_diff('microsecond',datetime(2017-10-30 23:00:00.1009001),datetime(2017-10-30 23:00:00.1008009)),
nanosecond = datetime_diff('nanosecond',datetime(2017-10-30 23:00:00.0000000),datetime(2017-10-30 23:00:00.0000007))
yearyear quarterquarter monthmonth weekweek dayday hourhour minuteminute secondsecond millisecondomillisecond microsecondomicrosecond nanosecondonanosecond
1717 22 1313 55 2929 22 55 1010 100100 100100 -700-700