else if (pair.Name.equalsIgnoreCase('startDate')) {
String activityStartDate = pair.value;
if (activityStartDate != null && activityStartDate != '') {
DateTime gmtTime = DateTime.valueOf(activityStartDate);
activity.startDate = DateTime.valueOf(activityStartDate).addMinutes(Userinfo.getTimeZone().getOffset(gmtTime) / (1000 * 60));
}
1 个回答
Hello, If what you want is to convert the value back to date time correctly, try the following:
String activityStartDate = pair.value;
DateTime dtExample = (DateTime)JSON.deserialize('"' + activityStartDate + '"', DateTime.class);
This should return something like this: 2022-12-15 00:00:00