So, I was recently working with a Web-To-Lead form in Salesforce and realized that all my values were being inserted into the new Lead record except for one field. Yes, it was a DateTime field – a custom one. I figured out that that it must be the format issue, so, I began trying multiple formats.
While looking for different formats online, I came to find that some DateTime formats that worked for others in their Web-To-Lead forms, didn’t work for me at all. In fact, many had faced the same issue. Some formats worked for some while didn’t work for others.
Instead of trying various formats, I started looking further into the problem and soon came to understand that DateTime field formats in Salesforce’s Web-To-Lead depend on the Locale and Time Zone set in Salesforce settings. In my case, the locale and timezone were of Germany, while I was trying US DateTime formats (that worked for the people with US timezone in Salesforce).
So, if you want to find out the correct format for your Web-To-Lead form, follow the steps below:
- Go to the Salesforce instance in which you created the Web-To-Lead form
- Go to Settings and then Language and Time Zone
- Check your Locale and Timezone
- Based on your Locale, get the correct DateTime format from the official Salesforce documentation
DateTime format in Web-To-Lead form
|German (Germany)||28.01.2008, 16:30|
|English (Canada)||2008-01-28, 4:30 p.m.|
|English (United Kingdom)||28/01/2008, 16:30|
|English (Pakistan)||28/01/2008, 4:30 pm|
|English (United States)||1/28/2008, 4:30 PM|
That was all about The correct format of the DateTime field in the Web-To-Lead form – Salesforce. I hope this will help you get your DateTime format right in your Web-To-Lead form. To learn how to create a file from an email attachment in Salesforce or for more similar guides, keep following Salesforce Guides.
- How to find Salesforce org type via Apex code?
- How to use Lookup field in Web To Lead form in Salesforce