cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
wencun6
Level III

bin each row based on date time

I often need to bin each row based on the date time. However, this is kind of troublesome for the data time. let say I am binning based before 7/22/2020 12:00:00pm as Good and after as bad. I can use the IF formula logic to compare the date time to 7/22/2020 12:00:00pm. But to do that I need to convert to the numeric value of 3678264000. if there any quicker way to do this? thanks 

5 REPLIES 5
txnelson
Super User

Re: bin each row based on date time

what you need to use is the Informat() function

if( :date < informat("01/22/2020","m/d/y" ), "Good", "Bad");

 

Jim
Thierry_S
Super User

Re: bin each row based on date time

Hi,

 

Have you considered the "Informat" function, such as used below:

If( :Column 1 < Informat( "07/21/2020 12:00 PM", "MM/dd/yyyy hr:min" ),
	1,
	0
)

Best,

 

TS

Thierry R. Sornasse
wencun6
Level III

Re: bin each row based on date time

many thanks both. The informat works perfectly.

Thierry_S
Super User

Re: bin each row based on date time

Hi,
If you don't mind, could you select our answers as "Solutions": it will let other users know that this question has been addressed
Best,
TS
Thierry R. Sornasse
Jeff_Perkinson
Community Manager Community Manager

Re: bin each row based on date time

You can use a date literal in JSL or the formula editor. You just need to use the ddMONyyyy format.

 

date=22Jul2020;

tomorrow=22Jul2020+in days(1);

show(date, tomorrow, format(tomorrow, "mm/dd/yyyy"));

in the log you get:

date = 22Jul2020;
tomorrow = 3678307200;
Format(tomorrow, "mm/dd/yyyy") = "07/23/2020";

Read more: Using dates, times, datetimes and durations in JMP 

-Jeff