home contribute faq download

FunctX XQuery Functions

Dates, Times and Durations


Constructing and Converting

functx:mmddyyyy-to-dateConverts a string with format MMDDYYYY (with any delimiters) to a date
fn:dateTimeConstruct a dateTime from a date and time
functx:dateTimeConstruct a date/time from individual components
functx:dateConstruct a date from a year, month and day
functx:timeConstruct a time from an hour, minute and second

Day of Week

functx:day-of-weekThe day of the week, from a date
functx:day-of-week-name-enThe name of the day of the week, from a date, in English
functx:day-of-week-abbrev-enThe abbreviated day of the week, from a date, in English


functx:first-day-of-yearThe first day of the year of a date
functx:last-day-of-yearThe last day of the month of a date
functx:is-leap-yearWhether a date falls in a leap year
fn:year-from-dateTimeThe year portion of a date/time
fn:year-from-dateThe year portion of a date


functx:month-name-enThe month of a date as a word (January, February, etc.)
functx:month-abbrev-enThe month of a date as an abbreviated word (Jan, Feb, etc.)
functx:first-day-of-monthThe first day of the month of a date
functx:last-day-of-monthThe last day of the month of a date
functx:days-in-monthNumber of days in the month
fn:month-from-dateTimeThe month portion of a date/time
fn:month-from-dateThe month portion of a date
functx:add-monthsAdds months to a date


functx:next-dayThe next day
functx:previous-dayThe previous day
functx:day-in-yearThe day of the year (a number between 1 and 366)
fn:day-from-dateThe day portion of a date
fn:day-from-dateTimeThe day portion of a date/time


fn:hours-from-dateTimeThe hour portion of a date/time
fn:hours-from-timeThe hour portion of a time
fn:minutes-from-dateTimeThe minute portion of a date/time
fn:minutes-from-timeThe minute portion of a time
fn:seconds-from-dateTimeThe seconds portion of a date/time
fn:seconds-from-timeThe seconds portion of a time


functx:total-seconds-from-durationThe total number of seconds in a dayTimeDuration
functx:total-minutes-from-durationThe total number of minutes in a dayTimeDuration
functx:total-hours-from-durationThe total number of hours in a dayTimeDuration
functx:total-days-from-durationThe total number of days in a dayTimeDuration
functx:total-months-from-durationThe total number of months in a yearMonthDuration
functx:total-years-from-durationThe total number of years in a yearMonthDuration
functx:yearMonthDurationConstruct a yearMonthDuration from a number of years and months
functx:dayTimeDurationConstruct a dayTimeDuration from a number of days, hours, etc.
fn:days-from-durationThe number of days in a duration
fn:hours-from-durationThe hours in a duration
fn:minutes-from-durationThe number of minutes in a duration
fn:seconds-from-durationThe number of seconds in a duration
fn:months-from-durationThe number of months in a duration
fn:years-from-durationThe number of years in a duration


fn:current-dateThe current date
fn:current-dateTimeThe current date/time
fn:current-timeThe current time

Time Zones

fn:adjust-dateTime-to-timezoneAdjusts a dateTime to a specific timezone, or no timezone
fn:adjust-date-to-timezoneAdjusts a date to a specific timezone, or no timezone
fn:adjust-time-to-timezoneAdjusts a time to a specific timezone, or no timezone
fn:implicit-timezoneThe implicit timezone set by the processor
fn:timezone-from-dateThe timezone portion of a date
fn:timezone-from-dateTimeThe timezone portion of a date/time
fn:timezone-from-timeThe timezone portion of a time
functx:duration-from-timezoneConverts a timezone like "-05:00" or "Z" into xs:dayTimeDuration
functx:timezone-from-durationConverts an xs:dayTimeDuration into a timezone like "-05:00" or "Z"

Datypic XQuery Services

Recommended Reading: