BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DrBigAl
Fluorite | Level 6

 Hi Community!

 

I am having a difficult time converting Date/Time differences into HH:MM. I want to know how many hours and minutes are between two dates. For instance:

 

EVENT_CAPTURED_DT_SENT        EVENT_CAPTURED_DT_OPEN

02Feb2018 17:31:15.00                     01Mar2018 3:40:41.00


I need the output to express the difference in time as.....354:15 (example of HH:MM)

 

I am currently using the HMS function, but only giving me the difference in time and not the difference between date/time.

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
Opal | Level 21

Why not just compute the number of hours?  (You would have 341.25 instead of 341:15)

 

It's easy to obtain, and easy to use in computations down the road:

 

duration_hours = (event_captured_dt_open - event_captured_dt_sent) / 3600;

View solution in original post

2 REPLIES 2
Astounding
Opal | Level 21

Why not just compute the number of hours?  (You would have 341.25 instead of 341:15)

 

It's easy to obtain, and easy to use in computations down the road:

 

duration_hours = (event_captured_dt_open - event_captured_dt_sent) / 3600;

PGStats
Opal | Level 21

the HHMM. format does it for you:

 

data test;
sent_dt = '02Feb2018 17:31:15.00'dt;
open_dt = '01Mar2018 3:40:41.00'dt;
interval = open_dt - sent_dt;
format interval hhmm8.;
run;

proc print; run;
PG

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 736 views
  • 3 likes
  • 3 in conversation