YEAR()

YEAR() operator returns the year portion of its DATE or DATETIME operand.

YEAR() returns all four digits of the year value - 2020, not 20.

This example program shows how the YEAR() operator can be used:

MAIN

DEFINE my_date DATE

LET my_date = TODAY

DISPLAY "Today is ", my_date

DISPLAY "Day: ", trim(DAY(my_date))

DISPLAY "Month: ", trim(MONTH(my_date))

DISPLAY "Year: ", trim(YEAR(my_date))

END MAIN

The example programs, year and year_md, show how to get both 2- and 4-digit number of the year.

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.