Date Manipulation - Extracting information using functions

#1

We can get year, month, day etc from date or timestamp using functions. There are functions such as day, dayofmonth, month, weekofyear, year etc available for us.

DESCRIBE FUNCTION day;
DESCRIBE FUNCTION dayofmonth;
DESCRIBE FUNCTION month;
DESCRIBE FUNCTION weekofyear;
DESCRIBE FUNCTION year;

Let us see the usage of the functions such as day, dayofmonth, month, weekofyear, year etc.

SELECT year(current_date);
SELECT month(current_date);
SELECT weekofyear(current_date);
SELECT day(current_date);
SELECT dayofmonth(current_date);

Practice hive on state of the art Big Data cluster - https://labs.itversity.com
You can sign up for our courses on Udemy using $10 coupons - Udemy Coupons - Big Data Courses


0 Likes