You need to sign in to do that
Don't have an account?
karthik karthik
how to convert string to date
Hi,
i want to convert string to date format, when i try to solve this i got the following error " System.TypeException: Invalid date/time: 9/25/2014 7:21:49 PM"
my code is like below
DateTime dt = DateTime.valueof('9/25/2014 7:21:49 PM');
string strdate = dt.format('mm/dd/yyyy');
tf.Resolve_Schedule_date__c = date.valueof(strdate);
if anyone know pls me.........
Thanks in Advance.
i want to convert string to date format, when i try to solve this i got the following error " System.TypeException: Invalid date/time: 9/25/2014 7:21:49 PM"
my code is like below
DateTime dt = DateTime.valueof('9/25/2014 7:21:49 PM');
string strdate = dt.format('mm/dd/yyyy');
tf.Resolve_Schedule_date__c = date.valueof(strdate);
if anyone know pls me.........
Thanks in Advance.
DateTime dt = DateTime.parse('27/10/2014 10:00 AM');
http://salesforce.stackexchange.com/questions/36376/how-to-convert-date-string-to-datetime-type-without-gmt
http://stackoverflow.com/questions/18039145/string-to-datetime-conversion-in-salesforce
You just need to convert your string in the format that is acceptable by any of the Date method to create new date instance.
See Date methods :
http://www.salesforce.com/us/developer/docs/dbcom_apex230/Content/apex_methods_system_date.htm