cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
BioMTT
Level I

Turning date/time data into days for individual runs

Hello, 

Trying to use a formula (or JSL if I need to) to get days for manufacturing runs. I think I need two If/ then statements to get the days to go from 0-12, given the run number/ batch ID and the date/time stamp right? I have tried a few formulas, and searched this forum (and google); however, I have not been able to get the correct output. Unfortunately my programing days are so long ago I can only write the most basic lines. I have JMP 18 and a few weeks to get this, so any ideas would be great! Also I attached a small sample of the date/time format I am attempting to put into days (so I can compare run data from different years, with days on the X axis alone).............Thanks MTT

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Turning date/time data into days for individual runs

Not sure how you wish to do it, but could you just add time of day to the days? You can create Time Of Day column using right click quick formula on your Date/Time column, then add that to Day column BUT remember to divide the time of day by In Hours(24) (or 60*60*
24) to turn it into "days".

-Jarmo

View solution in original post

7 REPLIES 7
jthi
Super User

Re: Turning date/time data into days for individual runs

I'm not exactly sure what you are trying to do. What "days" are you looking for? Can you provide some examples / expected result in your example dataset?

-Jarmo
BioMTT
Level I

Re: Turning date/time data into days for individual runs

Hey thanks for the fast reply!! So trying to get to days for each run, but runs done in different years, so below is an example- does this make sense?

BioMTT_0-1760722490690.png

 

jthi
Super User

Re: Turning date/time data into days for individual runs

How should the days be calculated? First date of a Run is 0 and then add days after that? If that is the case, create a date column

jthi_0-1760725845249.png

Then use 

(:Date - Col Min(:Date, :Run)) / In Days(1)

 

in separate formula

jthi_1-1760725930256.png

-Jarmo
BioMTT
Level I

Re: Turning date/time data into days for individual runs

Ok that looks close- so I will try that now- and will that reset to 0 days for each run? Would I have to use another if/then to reset to day 0 for each batch? Again thanks for the quick response(s)!

jthi
Super User

Re: Turning date/time data into days for individual runs

You would do all those "reset" adjustments to the Col Min() function. If you want to reset it on Run

 

(:Date - Col Min(:Date, :Run)) / In Days(1)

Batch + Run

(:Date - Col Min(:Date, :Run, :Batch)) / In Days(1)

On smallest data

(:Date - Col Min(:Date)) / In Days(1)

and so on (Col Min(name, <By var, ...>) )

 

-Jarmo
BioMTT
Level I

Re: Turning date/time data into days for individual runs

Ok making progress and thanks for the tips; however, I need to figure out a way to not lose the resolution the time stamp gives us, because when we use day on the x axis, we need that to be spread out over the course of the entire day. Man not as simple as I was hoping for, but again I think we can get there- 

jthi
Super User

Re: Turning date/time data into days for individual runs

Not sure how you wish to do it, but could you just add time of day to the days? You can create Time Of Day column using right click quick formula on your Date/Time column, then add that to Day column BUT remember to divide the time of day by In Hours(24) (or 60*60*
24) to turn it into "days".

-Jarmo

Recommended Articles