Monday, November 26, 2007

Date Functions

Function

Oracle

Microsoft SQL Server

Date addition

(use +)

DATEADD

Date subtraction

(use -)

DATEDIFF

Last day of month

LAST_DAY

N/A

Time zone conversion

NEW_TIME

N/A

First weekday after date

NEXT_DAY

N/A

Convert date to string

TO_CHAR

DATENAME

Convert date to number

TO_NUMBER(TO_CHAR())

DATEPART

Convert string to date

TO_DATE

CAST

Get current date and time

SYSDATE

GETDATE()

No comments: