cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Ronaldo
Level II

about cal datetime..

hello.


col1 : 2024-07-12 14:21:33
col2 : 333
cal_col3 : 2024-07-12 19:54:33

“How can I calculate the date and time in Col3 by adding the minutes specified in Col2 to the date and time in Col1 in JMP?

For example, if Col1 contains 2024-02-01 14:21:33 and Col2 contains 333, I want Col3 to show 2024-02-01 19:54:33
1 ACCEPTED SOLUTION

Accepted Solutions
Thierry_S
Super User

Re: about cal datetime..

Hi,

You can use the "Date Increment" function to calculate what you need (see below)

Date Increment( :Col1, "Minute", :Col2)

Best,

TS

Thierry R. Sornasse

View solution in original post

5 REPLIES 5
Thierry_S
Super User

Re: about cal datetime..

Hi,

You can use the "Date Increment" function to calculate what you need (see below)

Date Increment( :Col1, "Minute", :Col2)

Best,

TS

Thierry R. Sornasse
txnelson
Super User

Re: about cal datetime..

If your col1 is a character column and not a JMP numeric DateTime column you will need to use this formula for the calculation

Date Increment(
	Informat( :col1, 
		"Format Pattern", "<YYYY><-><MM><-><DD><hh><:><mm><:><ss>" ),
	"Minute",
	:col2
)
Jim
Ronaldo
Level II

Re: about cal datetime..

thank you!! u r my teacher~!
jthi
Super User

Re: about cal datetime..

Date Increment() which was suggested is the best option. Only thing you have to remember with that is to use alignment "actual" (it default to start) IF you care about the seconds. If you leave it as default (start), it will remove seconds. You can compare these two formulas

Date Increment( :Col1, "Minute", :Col2)
Date Increment( :Col1, "Minute", :Col2, "actual")

jthi_0-1725204132184.png

 

Other option is to add the minutes as seconds to your date (you can use In Minutes() to perform the conversion or multiply by 60)

 

:Col1 + In Minutes(:Col2)

 

 

-Jarmo
txnelson
Super User

Re: about cal datetime..

And to fully complete the discussion, one can take the issue down to the basics and just multiply the number of seconds in a minute times the number of minutes to achieve the desired result.

:Col1 + :Col2 * 60
Jim