Cert++
Close

Date and time calculations in formula fields

Key Takeaway

The first step in any date formula is knowing which data type you have, because each type gives different results in arithmetic and handles time zones differently.

Formula fields can do math with dates and times, such as counting days until a payment is due, projecting a renewal date, or flagging stale records. Salesforce uses three separate data types for this: Date, Date/Time, and Time.

The three date and time data types
Data typeWhat it stores
DateA year, month, and day
Date/TimeA date plus a time, precise to the second
TimeA time of day with no date, precise to the millisecond, such as a business opening time

Date/Time and Time values handle time zones differently. Salesforce saves a Date/Time value in GMT and shows it in the viewer's time zone. Salesforce saves a Time value in the saving user's time zone and doesn't convert it for other viewers.

A field's name doesn't reveal its type. Created Date (CreatedDate) and Last Modified Date are Date/Time fields, but Last Activity Date is a Date field.

Platform App Builder Study Guide

Checklist progress

0/340Learned

Given a scenario, demonstrate the use of formula fields to meet stated business requirements

0/16

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Platform App Builder studiers.