When function

To use this function, choose Calc > Calculator.

Extracts the date and time portion of a date/time value such as "1/6/06 10:23." This function is useful in macros and formulas.

Syntax

WHEN(number_or_text)

For number_or_text enter a text string in a default date/time format such as "3/6/16 10:23", a column containing such values, or a numeric representation of a date/time value.

If you enter a numeric representation of a date/time value, Minitab returns the complete date/time, including the day, hour, minute, and second. If you store the result in a constant, the output is the numeric representation of the date/time value.

Example

Calculator expression Result
WHEN(41804.5) 6/14/2014 12:00:00 PM

For example, a sales manager wants to identify orders taken on or before 1/24/16 at 2:00 PM. The manager enters the expression WHEN(C2) <= WHEN("1/24/16 2:00:00 PM") and stores the results in C3. Minitab returns a 1 for values less than or equal to the value and a 0 for values greater than the value.

C2-D C3
Order Before 2 pm?
1/12/2016 8:15 AM 1
1/24/2016 10:15 AM 1
1/13/2016 2:45 PM 1
1/10/2016 3:10 PM 1
1/14/2016 9:30 AM 1
1/4/2016 4:40 AM 1
1/10/2016 2:10 PM 1
1/24/2016 3:15 PM 0
1/23/2016 7:45 AM 1
1/12/2016 1:15 PM 1