Datetime values are handled internally as numbers of seconds since midnight, January 1, 1904.
The expression x=01Jan1904 sets x to zero, since the indicated date is the base date or “zero date” in JMP. If you examine the values of dates, they should be appropriately large numbers (for example, 5oct1998 is 2990390400).
Abbrev Date(date)
Description
Converts the provided date to a string.
Returns
A string representation of the date.
Argument
date
Can be the number of seconds since the base date (midnight, January 1, 1904), or any date-time operator.
Example
Abbrev Date( 29Feb2004 );
02/29/2004
See Also
Date-Time Functions and Formats in the Scripting Guide.
As Date(x)
Description
Formats the number or expression x so that it shows as a date or duration when displayed in a text window. Values that represent one year or more are returned as dates. Values that represent less than a year are returned as durations.
Returns
A date that is calculated from the number or expression provided.
Argument
x
Number or expression.
See Also
Date-Time Functions and Formats in the Scripting Guide.
Date Difference(datetime1, datetime2, "interval_name", <"alignment">)
Description
Returns the difference in intervals of two date-time values.
Returns
A number.
Arguments
datetime1, datetime2
Datetime values.
interval_name
A quoted string that contains a date-time interval, such as "Month", "Day", or "Hour".
alignment
An optional string. Options are as follows:
– "start" includes full or partial intervals.
– "actual" counts only whole intervals.
– "fractional" returns fractional differences using averages for "Year", "Quarter", and "Month" intervals.
Date DMY(day, month, year)
Description
Constructs a date value from the arguments.
Returns
The specified date, expressed as the number of seconds since midnight, 1 January 1904.
Arguments
day
number, day of month, 1-31. Note that there is no error-checking, so you can enter February 31.
month
number of month, 1-12.
year
number of year.
Date Increment(datetime, "interval_name", <increment>, <"alignment">)
Description
Adds 1 or more intervals to a starting datetime value.
Returns
Returns the new datetime value.
Arguments
datetime
The starting datetime value.
interval_name
A quoted string that contains the name of a datetime interval. "Year", "Quarter", "Month", "Week", "Day", "Hour", "Minute", and "Second" are supported.
increment
An optional number that specifies the number of intervals. The default value is 1.
alignment
An optional quoted string that contains a keyword:
– "start" truncates the date to the nearest interval prior to adding the increment. For example, it removes the time and outputs the date. "start" is the default value.
– "actual" retains the full input datetime value.
– "fractional" allows fractional incremental values using averages for the duration of "Year", "Quarter", and "Month" intervals.
Date MDY(month, day, year)
Description
Constructs a date value from the arguments.
Returns
The specified date, expressed as the number of seconds since midnight, 1 January 1904.
Arguments
month
number of month, 1-12.
day
number, day of month, 1-31. Note that there is no error-checking, so you can enter February 31.
year
number of year.
Day(datetime)
Description
Determine the day of the month supplied by the datetime argument.
Returns
Returns an integer representation for the day of the month of the date supplied.
Arguments
datetime
Number of seconds since midnight, 1 January 1904. This can also be an expression.
Example
d1 = Date DMY( 12, 2, 2003 );
3127852800
Day( 3127852800 );
12
Day( d1 );
12
Day Of Week(datetime)
Description
Determine the day of the week supplied by the datetime argument.
Returns
Returns an integer representation for the day of the week of the date supplied.
Arguments
datetime
Number of seconds since midnight, 1 January 1904. This can also be an expression.
Day Of Year(datetime)
Description
Determine the day of the year supplied by the datetime argument.
Returns
Returns an integer representation for the day of the year of the date supplied.
Arguments
datetime
Number of seconds since midnight, 1 January 1904. This can also be an expression.
Format(x, width|<width, decimal places>, <"Use thousands separator">)
Format(x, "Best", <width>, <"Use thousands separator">)
Format(x, ("Fixed Dec"|"Percent"), width|<width, decimal places>, <"Use thousands separator">)
Format(x, "Pvalue", <width>)
Format(x, ("Scientific"|"Engineering"|"Engineering SI"), <width>|<width, decimal places>)
Format(x,"Precision", width|<width, decimal places>, <"Use thousands separator">, <"Keep trailing zeroes">, <"Keep all whole digits">)
Format(x, "Currency", <"currency code">, <width>|<width, decimal places>, <"Use thousands separator">, < <<Use Locale(0|1) >)
Format(x, "datetime", <width>)
Format(x, ("Latitude DDD"|"Latitude DDM"|"Latitude DMS"|"Longitude DDD"|"Longitude DDM"|"Longitude DDM"), width|<width, decimal places>, ("PUN"|"DIR"|"PUNDIR"))
Format(x, "Custom", Formula(), <width>)
Description
Converts the value x into the "format" that you specify in the subsequent arguments.
Returns
Returns the text that corresponds to the number in the specified format.
Arguments
See Numeric Formats in Using JMP for more information about the arguments. The arguments are also shown in the data table Column Info window.
Examples
Format( x, 10, 2, "Use thousands separator");
Format( x, "Currency", "EUR", 20, <<Use Locale(0)); // ignores computer locale
Format( x, "m/d/y", 10 );
Format( x, "Precision", 10, 2, "Keep trailing zeroes", "Keep all whole digits" );
Format( x, "Latitude DDD", "PUNDIR"); // "PUN" for punctuation, "DIR" for direction, PUNDIR for both
Format( x, "Custom", Formula( Abs( value ) ), 15 );
Notes
• For more information about formatting currency, see Currency in the Scripting Guide.
• You must always precede the number of decimal places with the width.
Format Date(x, "datetime", <width>)
Description
Converts the value of x into the "datetime" that you specify in the second argument. Format choices are those shown in the data table Column Info window.
Returns
Returns the number in the specified format.
Arguments
See Numeric Formats in Using JMP for more information about the arguments.
Example
Format Date( Today(), "yyyQq" );
Hour(datetime, <12|24>)
Description
Determines the hour supplied by the datetime argument.
Returns
Returns an integer representation for the hour part of the date-time value supplied.
Arguments
datetime
Number of seconds since midnight, 1 January 1904. This can also be an expression.
12|24
Changes the mode to 12 hours (with am and pm). The default is 24-hour mode.
HP Time()
Description
Returns a high precision time value (in microseconds). This function is only useful relative to another HP Time() value. The time value represents the number of microseconds since the start of the JMP session.
Note
For less precise time values use Tick Seconds().
In Days(n)
Description
Returns the number of seconds per n days. Divide by this function to express seconds as days.
Informat("string", "format")
Parse Date("string", "format")
Description
Parses a string of a given "format" and returns a date/time value. The value is expressed as if surrounded by the As Date() function, returning the date in "ddMonyyyy" format.
Example
Informat( "07152000", "MMDDYYYY" );
15Jul2000
Notes
• To see the format options, open the Column Info window in a data table, select a date/time value for the format, and view the Input Format list.
• See Change Date-Time Input and Display Formats in the Scripting Guide for more examples.
• See As Date(x).
In Hours(n)
Description
Returns the number of seconds per n hours. Divide by this function to express seconds as hours.
In Minutes(n)
Description
Returns the number of seconds per n minutes. Divide by this function to express seconds as minutes.
In Weeks(n)
Description
Returns the number of seconds per n weeks. Divide by this function to express seconds as weeks.
In Years(n)
Description
Returns the number of seconds per n years. Divide by this function to express seconds as years.
Long Date(date)
Description
Returns a locale-specific string representation for the date supplied, formatted like "Sunday, February 29, 2004" or "Wednesday, November 9, 2011".
MDYHMS(date)
Description
Returns a string representation for the date supplied, formatted like "2/29/04 00:02:20".
Minute(datetime)
Description
Determines the minute supplied by the datetime argument, 0-59.
Returns
Returns an integer representation for the minute part of the date-time value supplied.
Month(date)
Description
Returns an integer representation for the month of the date supplied.
Parse Date()
See Informat("string", "format").
Quarter(datetime)
Description
Returns the annual quarter of a datetime value as an integer 1-4.
Second(datetime)
Description
Determines the second supplied by the datetime argument.
Returns
Returns an integer representation for the second part of the date-time value supplied.
Argument
datetime
Number of seconds since midnight, 1 January 1904. This can also be an expression.
Short Date(date)
Description
Returns a string representation for the date supplied, in the format mm/dd/yy. For example, "2/29/04" for the next Leap Day.
Tick Seconds()
Description
Measures the time taken for a script to run, measured down to the 60th of a second.
Note
For higher time value resolution (for example, microseconds) use the HP Time() function.
Time Of Day(datetime)
Description
Returns an integer representation for the time of day of the datetime supplied.
Today()
Description
Returns the current date and time expressed as the number of seconds since midnight, 1 January 1904. No arguments are available, but the parentheses are still necessary.
Week Of Year(date, <rule_n>)
Description
Returns the week of the year that contains a date-time value. Three rules determine when the first week of the year begins.
– With rule 1 (the default), weeks start on Sunday, with the first Sunday of the year being week 2. Week 1 is a partial week or empty.
– With rule 2, the first Sunday begins with week 1, with previous days being week 0.
– With rule 3, the ISO-8601 week number is returned. Weeks start on Monday. Week 1 is the first week of the year with four days in that year. It is possible for the first or last three days of the year to belong to the neighboring year’s week number.
Year(date)
Description
Returns an integer representation for the year of date.