function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShiftAaronShiftAaron 

Convert Date Time field to two separate fields

I have 1 field that is a datetime datatype and I need to be able to:

1. Split on the date & time using two separate fields for each

2. Convert the date to long date format -- January 7, 2010 

Steve :-/Steve :-/

To split a Date/Time field into 2 separate Date and Time fields you need to create 2 Formula Fields.

 

Field 1 :  Datatype = Formula(Date)

 

DATEVALUE( CreatedDate )

 

Field 2 :  Datatype = Formula(Text)

 

MID(TEXT(CreatedDate - 0.1667), 12, 5)

 

 

 ***  the -0.1557 part of the formula is to convert from GMT to my Local Time.

 

To convert your Date value to a Long Date format you're going to have to create a Text field and convert each part of your Date field to Text.  Sorry i don;t have any examples of that formula, but they're available in some of the Formula Guides 

Mano sfdcMano sfdc
Hi Steve,

Great job.
Please explain...
1) How you are defining value 0.1667, 0.1557.
2) I need IST time.

Thanks,
Manohar
ivy liivy li
Hi Manohar,

Created date save the datetime for GMT timezone, -0.1667 = -4/24, so i guess Steve is in GMT-4 timezone, also i guess 0.1557 is a type mistake.

Regards,
Ivy