Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to get year from date:
I am have the order_date colum in a table(like 07/20/1987), I need them to be in years. how can i get the years from dates? please help me with this.
Thank u.
Try this
Date(DateField,'YYYY') as Year or this way
date(date#(DateField,'MM/DD/YYYY'),'YYYY') as Year or simply write
Year(DateField) as Year
hope it helps
tried all nothing worked.
i am having the order date in orders table and quantity in order details table.
i joined the two by left join
Order date formate is like this:
1996-07-05 00:00:00.000
1996-07-08 00:00:00.000
1996-07-08 00:00:00.000
1996-07-09 00:00:00.000
1996-07-10 00:00:00.000
how can i get the year out of this,please help
num#(left(MyDate,4)) as Year
or year(date#(MyDate, 'YYYY-MM-DD hh:mm:ss.fff')) as Year
Write this in script where is your order date field
year(Date#([Order Date],'YYYY-MM-DD hh:mm:ss.hhh')) as Year
Hi
Try like this
Load *,
year(Date#([Order Date],'YYYY-MM-DD hh:mm:ss.hhh')) as Year
From tableName;