Declarative

The correct format of DateTime field in Web-To-Lead form in Salesforce

correct format of DateTime field in Web-To-Lead form

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

LocaleDateTime Format
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.

Also Read

Was this helpful?

Thanks for your feedback!

Talha Saqib

About Author

As a Salesforce Certified Developer, Talha Saqib is an expert in designing and implementing custom Salesforce solutions that help businesses achieve their goals. With 3+ years of experience in the Salesforce ecosystem, Talha has a deep understanding of the platform and is expert in Sales Cloud, Service Cloud, Experience Cloud, REST APIs, Aura and more.

Leave a comment

Your email address will not be published. Required fields are marked *

You may also like

Convert Country Code to Country Name
Declarative

Convert Country Code to Country Name in Google Sheets for Data Import Wizard

You would also have faced the same problem time and time again. You are given an Excel or CSV file
Declarative

How to add cross-object fields as merge fields in Lightning Email Template

Lightning Email Templates for sure are superior to their old counterpart, Classic Email Templates, however, they too come with certain