Publication date: 08/13/2020

Date-Time SQL Functions

Using date-time functions in JMP queries is complicated by the fact that the SQL engine that handles JMP queries (SQLite) uses different formats for storing dates than JMP does. SQLite stores date-times as strings. However, JMP stores date-times as the number of seconds since January 1, 1904. When you have columns in your table that contain date-times, the conversions are handled automatically. However, when you use functions that return date-times, you might need to let JMP know when a conversion is required.

Consider the CURRENT_TIMESTAMP function. CURRENT_TIMESTAMP is a built-in SQLite function that returns the current UTC/GMT time stamp as a SQLite time string:



"2016-02-16 15:44:42"

The string could perhaps be parsed as a date to return it as a JMP date. To prevent the need to do so, wrap the CURRENT_TIMESTAMP function in the JMPDATE() function:




The string is an unformatted JMP date. However, if you pass a SQLite time string to another SQL date-time function, you do not need to use JMPDate(); the value will be converted to a JMP date automatically. Here is an example:


Using native SQLite date-time functions (date(), time(), datetime(), julianday(), strftime()) in JMP queries is not recommended because JMP date-time values are not compatible with those functions.

Date-Time Function

Naive SQLite




Returns the current date (UTC/GMT) as a SQLite time string.



Returns the current time (UTC/GMT) as a SQLite time string.



Returns the current date and time (UTC/GMT) as a SQLite time string.

DATEDIFF( date1, date2, interval, <alignment = “Start”> )

Computes the difference between two dates in units specified by interval, based on alignment. This function works the same as the Date Difference() JSL function. Valid values for interval are: “Year”, “Quarter”, “Month”, “Week”, “Day”, “Hour”, “Minute” and “Second”. Valid values for alignment are “Start”, “Actual” and “Fractional”. If alignment is not specified, “Start” is used.

EXTRACT( datepart, datetime, <use_locale = 1> )

Extracts a specific part of a date or date-time value. Datetime is a JMP date-time value or a SQLite time string. Use_locale is optional and applies only to date name parts such as "MonthName" and "DayName" and determines whether values from the current language or English are returned. The following values of datepart are supported:


Returns the year as a number.


Returns the numeric month (1-12).


Returns the full name of the month in the current language (use_locale = 1) or English (use_locale = 0).

"Mon", "MMM"

Returns the abbreviated name of the month.


Returns the day of the month (1-31).


Returns the name of the day of the week.


Returns the numeric day of the week (1-7).


Returns the numeric day of the year (1-366).


Returns the numeric quarter (1-4).


Returns the hour (0-23).


Returns the minute (0-59).


Returns the seconds, including any fractional part.


Returns just the date portion of a date-time value as a JMP date-time value.


Returns just the time portion of a date-time value as a JMP date-time value.

JMPDATE( SQLite time string )

Converts a SQLite time string to the equivalent JMP date-time value.


A synonym for TODAY().


Returns the JMP date-time value of the current moment in local time, which matches the JMP Today() function.

Want more information? Have questions? Get answers in the JMP User Community (