+ Start a Discussion
SaranSaran 

String to date conversion

Hi All,

Is there is any standard method to convert the following string value to salesforce date format

december 14, 2014 To salesforce date format
Best Answer chosen by Saran
Art SmorodinArt Smorodin
Hi Saraz,

check out this post: 
https://developer.salesforce.com/forums/ForumsMain?id=906F000000096TdIAI

Art.

All Answers

Art SmorodinArt Smorodin
Hi Saraz,

check out this post: 
https://developer.salesforce.com/forums/ForumsMain?id=906F000000096TdIAI

Art.
This was selected as the best answer
Virendra ChouhanVirendra Chouhan
Hi Saraz,
You can use valueOf method of Date Class.
check all methods in Date
http://www.salesforce.com/us/developer/docs/dbcom_apex230/Content/apex_methods_system_date.htm
 
string year = '2008';
string month = '10';
string day = '5';
string hour = '12';
string minute = '20';
string second = '20';
string stringDate = year + '-' + month
 + '-' + day + ' ' + hour + ':' + 
minute + ':' + second;

Date myDate = date.valueOf(stringDate);