You need to sign in to do that
Don't have an account?
S Gogati
I want to show the LastModified Date in user's Local time Zone
Hi Team,
I Need to show the LastModified Date in user's Local time Zone, Using SOSL am getting data from salesforce. And trying with bellow method, but no luck.
Can anyone help on this?
public static String formatDateBasedOnLocale( String value ) {
/*DateTime dateTimeToFormat = DateTime.valueOf( value );
Date dateToFormat = dateTimeToFormat.date();
return dateToFormat.format();*/
/*String timeZone = UserInfo.getTimeZone().getID();
Datetime dateGMT=DateTime.valueOf( value );
Datetime d1=Datetime.valueOf(dateGMT);
return d1.format();*/
System.debug('UserInfo.getTimeZone().getID() '+UserInfo.getTimeZone().getID());
System.debug('value '+value );
DateTime param_time= DateTime.valueOf( value );
string var_time = param_time.format('yyyy-MM-dd HH:mm:ss',UserInfo.getTimeZone().getID());
return datetime.valueOf(var_time).format();
}
I Need to show the LastModified Date in user's Local time Zone, Using SOSL am getting data from salesforce. And trying with bellow method, but no luck.
Can anyone help on this?
public static String formatDateBasedOnLocale( String value ) {
/*DateTime dateTimeToFormat = DateTime.valueOf( value );
Date dateToFormat = dateTimeToFormat.date();
return dateToFormat.format();*/
/*String timeZone = UserInfo.getTimeZone().getID();
Datetime dateGMT=DateTime.valueOf( value );
Datetime d1=Datetime.valueOf(dateGMT);
return d1.format();*/
System.debug('UserInfo.getTimeZone().getID() '+UserInfo.getTimeZone().getID());
System.debug('value '+value );
DateTime param_time= DateTime.valueOf( value );
string var_time = param_time.format('yyyy-MM-dd HH:mm:ss',UserInfo.getTimeZone().getID());
return datetime.valueOf(var_time).format();
}
Please refer below sample code from the link
http://salesforce.stackexchange.com/questions/4279/createddate-in-users-local-timezone
Hope this helps you!
Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya