You need to sign in to do that
Don't have an account?
crocodile
Type casting a Date variable into String type?
Hi,
I tried to convert a Date variable into String type using toString() but getting an error. Can any one please mention how to convert a Date variable into String type.
Thanks in adv,
-Vissu
I tried to convert a Date variable into String type using toString() but getting an error. Can any one please mention how to convert a Date variable into String type.
Thanks in adv,
-Vissu
This function returns all Date-time in desired format.
*/
public static String getFormattedDateTime(Datetime value, Integer formatType)
{
String formattedDate = '';
if(value!=null)
{
if(formatType == 1)
formattedDate = value.format('MMM dd, yyyy','GMT - 8:00');
else if (formatType == 2)
formattedDate = value.format('yyyy-MM-dd','GMT - 8:00');
else if(formatType == 3)
formattedDate = value.format('MMM dd, yyyy h:mm:ss a (z)','GMT - 8:00');
}
return formattedDate;
}