# Date Calculated Fields

## Date formulas can be used to output different date and time information.

### The functions included in the date category are:

Function Name Syntax and Sample
date: date will return a date set to the values you include in your formula. Syntax: date({year},{month},{day},{hour},{minute},{second})
Sample: date(1971,11,08,12,59,08)
day: day uses the date syntax, and returns the third value in the formula. Syntax: day({date})
Sample: day(date(1971,11,08,01,22,44))
hour: hour uses the date syntax, and returns the fourth value in the formula. Syntax: hour({date})
Sample: hour(date(2017,12,1,12,33,48))
minute: minute uses the date syntax, and returns the fifth value in the formula. Syntax: minute({date})
Sample: minute(date(2017,12,1,12,33,48))
month: month uses the date syntax, and returns the second value in the formula. Syntax: month({date})
Sample: month(date(2017,12,1,12,33,48))
monthname: monthname uses the date syntax, and returns the month name for a date. Syntax: monthname({date},{locale})
Sample: monthname(date(2017,12,1,12,33,48),"en")
now: now returns the current date and time. Syntax: now()
Sample: now()
quarter: quarter uses the date syntax, and returns the quarter to which your date belongs. Syntax: quarter({date})
Sample: quarter(date(2017,12,1,12,33,48))
second: second uses the date syntax, and returns the sixth value in the formula. Syntax: second({date})
Sample: second(date(2017,12,1,12,33,48))
time: When you use time, Reveal will return a time set to the values you include in your formula. Syntax: time({hour},{minute},{second},{millisecond})
Sample: time(11,08,08,11)
today: today returns the current date. Syntax: today()
Sample: today()
weekday: weekday uses the date syntax, and returns the day of the week your date falls into. Syntax: weekday({date})
Sample: weekday(date(2017,12,1,12,33,48))
weeknum: weeknum uses the date syntax, and returns the number of the week your date falls into within the specified year. Syntax: weeknum({date})
Sample: weeknum(date(2017,12,1,12,33,48))
year: year uses the date syntax, and returns the first value in the formula. Syntax: year({date})
Sample: year(date(2017,12,1,12,33,48))
datediff: find the difference between two dates.

DateDiff([start_datetime], [end_datetime], "d")

You will need to adjust the function to include the date fields you are looking to use. You can also adjust the third parameter, which corresponds to:

"d" difference in days
"h" difference in hours
"dh" difference in remaining hours