目次
When automating operations using Salesforce flows, it is very common to use date and time as conditions for retrieving data. However, Salesforce manages date and time information in UTC (Universal Coordinated Time) within the system, so specifying conditions in Japan Standard Time (JST) may produce unintended results. This article explains the difference between UTC and JST that you should be aware of when retrieving data based on date and time in flows.
1. Basics of DateTime Management in Salesforce
Salesforce DateTime type fields are internally stored in **UTC (Coordinated Universal Time)**, sometimes referred to as “GMT” in Salesforce, but technically UTC is the correct representation.
When a user enters a date and time in the UI, Salesforce adjusts the display according to that user’s time zone setting. For example, if a user in Japan enters “2025/09/06 10:00”, Salesforce internally stores it as “2025/09/06 01:00 UTC”.
In other words, it is important to understand that there is a difference between the user’s time zone display and the internally stored time.
Important Points
- Date type items: not affected by time zone
- DateTime type items: stored in UTC and converted to the user’s time zone when displayed (this is what we are talking about here)
- Time type items: not affected by time zone
2. Notes on the “Get Element (Get Records)” in the flow
When using the “Get Element” in a Salesforce flow to retrieve records conditional on a date or time, problems can easily occur.
Example: Case to retrieve records for a specific time period
You want to retrieve records created between “2025/09/06 10:00-15:00” in JST:
JST time
10:00 JST → 01:00 UTC
15:00 JST → 06:00 UTC
The actual conditions in the flow are as follows
CreatedDate >= 2025/09/06 01:00:00Z AND
CreatedDate <= 2025/09/06 06:00:00Z
As shown above, there is a 9-hour difference between JST and UTC, which results in not being able to retrieve records in the intended time zone. Please be sure to use the debugging function to confirm that you are able to retrieve records in the intended time zone.
4. Countermeasures
(1) Use Date-type fields and DATEVALUE function
If you want to acquire records in “date units” without worrying about the time part of the date and time:
DATEVALUE(CreatedDate) = TODAY()
This method can accurately determine the date as today’s date in the user time zone.
(2) Time Zone Conversion with Formula Resources
When specifying up to the time, use a formula resource to explicitly perform time zone conversion.
Formula example: Convert JST time to UTC
DATETIMEVALUE("2025-09-06 10:00:00") - TIME(9, 0, 0, 0, 0)
5. Cases to watch out for
Schedule Trigger Flow
Scheduled flows that are triggered at midnight every day will execute based on the time zone of the user who created the flow. If the flow is created by a user in Japan, it will execute at midnight JST.
6. Best Practices
Recommended Design Patterns
- Date-only conditions: Use the
DATEVALUE() function
- Conditions with time: Explicit time zone conversion in formula resources
- Testing: Run tests with users in different time zones
Code Example: Creating Safe Date/Time Conditions
Formula Resource Example
Today's start time (convert JST 00:00 to UTC)
DATETIMEVALUE(TEXT(TODAY()) " 00:00:00") - TIME(9, 0, 0, 0)
End time of today (converted from JST 23:59 to UTC)
DATETIMEVALUE(TEXT(TODAY()) " 23:59:59") - TIME(9, 0, 0, 0, 0)
7. Summary
It is important to keep the following points in mind when retrieving records based on date and time in a Salesforce flow:
Important point
- Salesforce internally manages DateTime type fields in UTC
- When setting conditions in JST, consider the time difference from UTC (-9 hours)
- Use the DATEVALUE function to get the date unit
- Explicitly convert conditions that include time using formula resources
By putting these practices into practice, acquisition errors and unintended behavior can be greatly reduced.