在 UI 中呈现和显示 DateTime 字段时,Salesforce 会遵循行业标准将 UTC 转换为本地时间(基于“查看用户”的区域设置)。 UI 上显示的字段值取决于此字段中的“实际值”,以及“查看用户”的区域设置。
该值不依赖于字段的修改日期,并且将保持不变,与查看记录的时间(夏令时内或夏令时外)无关。
让我们来看一个例子,用户将用户区域设置为:(GMT+00:00) 格林威治标准时间(欧洲/伦敦),并适用夏令时:
2023 年 3 月的周日(2023 年 3 月 26 日)凌晨 01:00,是英国的夏令时期间,将在 10 月的最后一个周日(2023 年 10 月 29日)凌晨 02:00 后退一小时
如果在 Salesforce 中查看任何记录的 DateTime 字段值:
假设对象有以下两个 DateTime 字段
DateTime1__c
DateTime2__c
方案 1:以区域设置为 (GMT+00:00) 格林威治标准时间(欧洲/伦敦)的用户身份登录,并在 UI 中输入以下值
DateTime1__c =18th Aug 2023, 14:00 /*这一天/DateTime 在英国的 2023 年夏令时期间内
DateTime2__c =1st Dec 2023, 14:00 /* 这一天/DateTime 不在夏令时期间
以下数据将存储在数据库中:
DateTime1__c =18th Aug 2023, 13:00 GMT+00:00:00
DateTime2__c =1st Dec 2023, 14:00 GMT+00:00:00
场景 2:以区域设置为 (GMT+00:00) 格林威治标准时间(欧洲/伦敦)的用户身份登录,并显示上述记录
以下数据将显示在 UI 上
DateTime1__c =18th Aug 2023, 14:00。
DateTime2__c =1st Dec 2023, 14:00。
场景 3:以使用 (GMT+00:00)格林威治标准时间 (GMT) 的用户身份登录,以显示上述记录
以下数据将显示在 UI 上
DateTime1__c =18th Aug 2023, 13:00。
DateTime2__c =1st Dec 2023, 14:00。
如果任何最终用户想要检查 UI 上显示的 DateTime 字段值是否受夏令时影响,他们只需检查 DateTime 字段中显示的“实际值”和登录用户的时区。修改字段值的 DateTime 既不影响 UI 上显示的值,也不影响数据库中存储的值。
Salesforce 在将 UTC 转换为本地时间(基于查看用户的区域设置)时遵循行业标准,以在 UI 中显示 DateTime 字段值,确保此过程中没有歧义。
000397140

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.