Desktop productivity for business analysts and programmers

I can not extract part of a date

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

I can not extract part of a date

 

I have this table with some fields of type date (example, column DAT_INICIO_ENTREGA_PROPOSTA)

sas1.png

 

 
 
 
 
When I try to extract the year (or month, or day), the result is null (.)
sas1.png
 
Help me.

Accepted Solutions
Solution
‎09-02-2016 04:05 PM
Grand Advisor
Posts: 17,396

Re: I can not extract part of a date

Its hard to see because your pictures don't show clearly enough but I think you have a datetime not a date variable.

 

The functions Year/Month/Day require a date. To convert your datetime to a date use the DATEPART() function.

 

Year(datepart(date_var))

View solution in original post


All Replies
Solution
‎09-02-2016 04:05 PM
Grand Advisor
Posts: 17,396

Re: I can not extract part of a date

Its hard to see because your pictures don't show clearly enough but I think you have a datetime not a date variable.

 

The functions Year/Month/Day require a date. To convert your datetime to a date use the DATEPART() function.

 

Year(datepart(date_var))
New Contributor
Posts: 3

Re: I can not extract part of a date

Thanks.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 285 views
  • 0 likes
  • 2 in conversation