Keep in mind that complex date functions tend to compile to a larger size than text or number formula
functions, so you might run into issues with formula compile size. See Tips for Reducing Formula Size for
help with this problem.
TODAY(), NOW() and TIMENOW()
The TODAY() function returns the current day, month, and year as a Date data type. This function is
useful for formulas where you are concerned with how many days have passed since a previous date, the
date of a certain number of days in the future, or if you just want to display the current date.
The NOW() function returns the Date/Time value of the current moment. It’s useful when you are
concerned with specific times of day as well as the date.
The TIMENOW() function returns a value in GMT representing the current time without the date. Use
this function instead of the NOW() function if you want the current hour, minute, seconds, or milliseconds.
This value is useful for tracking time like work shifts or elapsed time,
For details on how to convert between Date values and Date/Time values, see Converting Between
Date/Time and Date on page 10.
The DATE() Function
The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and
the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE(
2013, 6, 1 ) returns June 1, 2013. Similarly, DATE( YEAR( TODAY() ), MONTH(
TODAY() ) + 3, 1) returns the Date value of the first day three months from today in the current
year, assuming the date is valid (for example, the month falls between 1 and 12).
If the inputted Y/M/D values result in an invalid date, the DATE() function returns an error, so error
checking is an important part of working with Date values. You can read about methods for handling
invalid dates in Sample Date Formulas.
Converting Between Date/Time and Date
Date and Date/Time aren’t interchangeable data types, so when you want to perform operations between
Date and Date/Time values, you need to convert the values so they are both the same type. Some functions
(such as YEAR(), MONTH(), and DAY()) also only work on Date values, so Date/Time values must
be converted first.
Use the DATEVALUE( date/time ) function to return the Date value of a Date/Time. For example,
to get the year from a Date/Time, use YEAR( DATEVALUE( date/time ) ) ).
You can convert a Date value to a Date/Time using the DATETIMEVALUE( date ) function. The
time will be set to 12:00 a.m. in Greenwich Mean Time (GMT), and then converted to the time zone of the
user viewing the record when it’s displayed. For a user located in San Francisco, DATETIMEVALUE(
TODAY() ) returns 5:00 p.m. on the previous day (during Daylight Saving Time) rather than 12:00 a.m.
of the current day. See A Note About Date/Time and Time Zones on page 12 for more information.
Converting Between Date/Time and Time
The TIMEVALUE() function returns a Time data type value in “HH:MM:SS.MS”
(hours:minutes:seconds.milliseconds) format using a 24-hour clock. Numerical H/M/S/MS values and the
10
Using Date, Date/Time, and Time Values in FormulasExamples of Advanced Formula Fields