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
Salesforce Test 5Salesforce Test 5 

Convert Text field Type to Date Type

Hi All

I have created a Text field type where i have entered the date  format like 1/2/2015.i want to update this value in date field type,how its possible
 
srinu vassrinu vas
hi,

you can use DATEVALUE(<text filed value>) to convert

Here's the link:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm
Amit Chaudhary 8Amit Chaudhary 8
Try below code. I hope that will help you
string Dt = '11/28/14';

String[] dts = dt.split('/');

Date myDate = date.newinstance(Integer.valueOf('20'+dts[2]), Integer.valueOf(dts[0]), Integer.valueOf(dts[1]));

System.debug('--------------------------'+myDate);
http://salesforce.stackexchange.com/questions/15098/how-to-convert-a-text-to-datetime
http://blogatsalesforce.blogspot.in/2015/04/convert-string-into-acceptable-datetime.html

Please let us know if this will help you

Thanks
AMit Chaudhary