Datetimevalue Salesforce is used to convert text to the datetime value. In this Salesforce tutorial, you will get to know about the salesforce datetimevalue function. Additionally, I will explain datetimevalue formula Salesforce.
The Salesforce Datetimevalue function is one of the Date and Time functions. The datetimevalue function is used to convert the date passed in text format or the date to the date and time format.
It returns the year, month, and date with time in GMT format, and you cannot change the time from GMT format to another time zone. Moreover, there is the proper format to enter the date as the text in the function; it would be in YYYY-MM-DD format only and enclosed in quotes; otherwise, you get an error.
Another thing is to make sure the passed date is within their range. For example, the month will be between 1 and 12, and the date will be between 1 and 31 only. Let’s see the syntax of the datetimevale function in Salesforce.
DATETIMEVALUE(expression)
expression: Pass the date or text to which you want to convert to the datetime expression.
DATETIMEVALUE Formula Salesforce
Below are the steps to create a formula using the DateTime value in Salesforce.
Step-1: Move to the Setup, click on the Object Manager, search for the Object, and click on it.
Step-2: Click on the Fields & Relationships option and click on the New button.
Step-3: Choose the Formula as the field type and click Next to proceed.
Step-4: Enter a Field Label for the formula; the Field Name will be filled in automatically. For example, Field Label as the Create Contact Time Date.
Then, select the Date/Time return type for the formula and click on Next.
Step-5: Fill out the Advance Formula editor with the DATETIMEVALUE formula. The formula is as follows:
DATETIMEVALE(CreatedDate)
In this formula, use the DATETIMEVALUE() formula to get the date and time of the contact created.
Here, pass the CreatedDate as a field to the function.
Click Check Syntax to make sure the formula is correct and add the Description and Help Text if you want and Handle Blank Fields.
Then, click on the Next.
Step-6: Choose the Profile to whom you want to grant the edit access to this field and click on the Next.
Step-7: Choose the Page Layout on which you want to add this field and click on the Save button.
Let’s see how it looks. Open the contact record, and in the detail section, you will see how the Datetimevalue function works.
Conclusion
I hope you understand the DATETIME VALUE function in Salesforce. I have also explained how to create DATETIMEVALUE formula in Salesforce.
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.
DOWNLOAD FREE AGENTFORCE EBOOK
Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.
FREE SALESFORCE FLOW EBOOK
Learn how to work with flows in Salesforce with 5 different real time examples.