Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level IV

## Is a date from column contained in date and time column?

Hi,

I´m trying to figure out if a date (from a column with ddMonyyy format) is contained in a date & time column (ddMonyyyy:h:m:s) and create a new column stating whether it is true or not.

I was trying:

``````If( Char( :Date ) == Substr( Char( :StartTime ), 1, 9 ),
1,
0
);``````

But that didn´t work.

I know I can convert the date and datetime column to strings in new columns and do the comparison but is it possible without doing that?

Br Julie

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

## Re: Is a date from column contained in date and time column?

Hi,

Pease see if this works for you:

``````If( Abbrev Date( :StartTime ) == Abbrev Date( :Date ),
1,
0
)``````
3 REPLIES 3
Highlighted
Staff

## Re: Is a date from column contained in date and time column?

Hi,

Pease see if this works for you:

``````If( Abbrev Date( :StartTime ) == Abbrev Date( :Date ),
1,
0
)``````
Highlighted
Level IV

## Re: Is a date from column contained in date and time column?

Thanks - worked like a charm

Highlighted
Staff

## Re: Is a date from column contained in date and time column?

Revised: Ha! I did not understand your problem, so please disregard my 'solution.'

I understand your problem as you want to know if the value in :Date is only a date with no time, too. That is, as JMP represents date and time, it is midnight on the given date. You can check that the residual seconds is zero.

``Not( Modulo( :Date, In Days( 1 ) ) )``

Learn it once, use it forever!
Article Labels