DATEDIFF(t,s)
DATEDIFF(t,s)
is a date function that calculates the number of days between a start
and end date.
t and s values: When used in a function, the
expressions t
and s
(date_or_timestamp_expression
)
must supply a date,
a time
stamp, or an alphanumeric value that matches the current date or
time stamp format.
t, s |
Result of DATEDIFF(t,s) Function |
|---|---|
Positive difference between |
Numeric value (number of days) |
|
Only the dates in the time stamp value are used to calculate |
|
|
Example
SELECT arrival, departure, DATEDIFF(departure,arrival) difference, rno
FROM reservation
WHERE rno = 130
|
|
|
|
|
|
|
|