Desktop productivity for business analysts and programmers

Simplified DateTime

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 104
Accepted Solution

Simplified DateTime


How can I make this DateTime variable (See below) to "01Jan2015:00:00:00.000"dt  and still have it as Date/Time variable.

Capture.PNG

thanks


Accepted Solutions
Solution
‎05-19-2015 06:55 PM
Grand Advisor
Posts: 10,211

Re: Simplified DateTime

or

datetimevariable = dhms(datepart(datetimevariable),0,0,0);

View solution in original post


All Replies
Frequent Contributor
Posts: 104

Re: Simplified DateTime

Just wanted to add.  I still want to keep it as Date/Time variable but with the seconds., etc as  00:00:00.000.

Respected Advisor
Posts: 3,063

Re: Simplified DateTime

proc format;

   picture MyDT
  other =
'%d%B%Y:%0H:%0M:%0s' (DATATYPE=DATETIME);

run;

data _null_;

  now = datetime();

  format now MyDT26.3;

  put now = ;

run;

Frequent Contributor
Posts: 104

Re: Simplified DateTime

It is not doing it.  I still have the same result, showing the trailing minutes and seconds.. I want minutes and seconds as 00:00:00.000.  The result I wanted like that because I have two data sets with PlayDate and IGTCreatedDate (see image below).  I want to join them together.

Capture.PNG

Above is just a sample data.  I want to show the format between PlayerDayDate and IGTAccountCreated.  Because of the format I cannot join them together. The reason I want to join them is to see if a guest join on 01May2015 and play on 01May2015.

Please help me.

Solution
‎05-19-2015 06:55 PM
Grand Advisor
Posts: 10,211

Re: Simplified DateTime

or

datetimevariable = dhms(datepart(datetimevariable),0,0,0);

Frequent Contributor
Posts: 104

Re: Simplified DateTime

Thank you, that is what I need.  You solved my problem.

Frequent Contributor
Posts: 104

Re: Simplified DateTime

Thank you

SASKiwi                                      

☑ This topic is SOLVED.

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

Discussion stats
  • 6 replies
  • 413 views
  • 3 likes
  • 3 in conversation