Can anyone help to solve this issue, i want after converting DateOfBirth into string the value remains same.

Value is - Sat Mar 01 00:00:00 EST 1980

  • What exactly you are looking for? Please be descriptive in your Question with the Expectations & Actuals! – Vignex Apr 20 '16 at 12:30

You can try to use the Datetime Class format() method to convert a DateTime to the local timezone returns a String. For more info, go through the link https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_datetime.htm#apex_System_Datetime_format_2


| improve this answer | |

Use Date.valueOf(DATE_OF_BIRTH)

it will take string argument and return Date Value

Is there anyway to get in DD/MM/YYYY or MM/DD/YYYY format

| improve this answer | |

Use valueOfGmt() function to convert date time to string

    string dob = string.valueOfGmt(DateOfBirth);

To convert String to Date time.

    Datetime Bday = Datetime.valueOfGMT(dob);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.