DATA Step, Macro, Functions and more

change datetime to date

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

change datetime to date

I have datatime in numeric format and i wnat to convert it into date format dd/mm/yy format

 

example:-

01APR3016 00:00:00 in numeric format

 

i want

 

01APR2016 in date format


Accepted Solutions
Solution
‎05-31-2016 05:40 AM
Super User
Super User
Posts: 7,392

Re: change datetime to date

In what scenario, if its for a report then format it as date9.:

format <variable> date9.;

 

If you want a variable as date9 then:

<new_variable>=datepart(<old_variable>);

format <new_variable> date9.;

View solution in original post


All Replies
Solution
‎05-31-2016 05:40 AM
Super User
Super User
Posts: 7,392

Re: change datetime to date

In what scenario, if its for a report then format it as date9.:

format <variable> date9.;

 

If you want a variable as date9 then:

<new_variable>=datepart(<old_variable>);

format <new_variable> date9.;

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 928 views
  • 1 like
  • 2 in conversation