function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GraceWGraceW 

simpleDateFormat for Event ActivityDateTime

Hi,
          Have a question about the SimpleDateFormat I should use to encode and decode the event activityDateTime. So the dateTimes need to be in ISO8601 format (e.g. 2006-12-22T13:00:00Z).
      
Should the right SimpleDateFormat be :new SimpleDateFormat(("yyyy-MM-dd'T'HH:mm:ss'Z'");
                                                          or  new SimpleDateFormat(("yyyy-MM-dd'T'HH:mm:ssZ")?





         Thanks!
GSP_4SGSP_4S
Technically, the 'Z' stands for "zero meridian" or "Zulu" (basically what used to be called Greewich Mean Time [GMT] and is now called Universal Time [UTC] ).  So 'Z' is only correct if the time being formatted it actually in UTC. (reference)

You could hard-code the 'Z' if you know you've converted your dates to GMT/UTC.  However, it's more likely that you want to put your actual timezone so a date formatted like 2007-01-14 12:12:21-0500 is perfectly legal.  In other words, use Z as a parameter not 'Z' as a literal in almost all cases.