Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rtanikella/02819bea36fb6bf569a28679390e4af3 to your computer and use it in GitHub Desktop.
Save rtanikella/02819bea36fb6bf569a28679390e4af3 to your computer and use it in GitHub Desktop.

Given the Salesforce standard way of textually representing dates (YYYY-MM-DDTHH:mm:ss.zzzZ, for example 2018-11-19T16:06:21.000Z), the following Excel formulae will help you parse out components: Assuming B2 is the cell in which the Salesfore date is entered

  • Year: =LEFT(B2,4)
  • Month: =RIGHT(LEFT(B2,7),2)
  • Day: =RIGHT(LEFT(B2,10),2)
  • Hour: =RIGHT(LEFT(B2,10),2)
  • Min: =RIGHT(LEFT(B2,10),2)
  • Sec: =RIGHT(LEFT(B2,19),2)
  • Timezone: =RIGHT(B2,4)
  • Excel-native number that represents the date in Microsoft Excel date-time code: =DATEVALUE(CONCATENATE(RIGHT(LEFT(B2,7),2),"/",RIGHT(LEFT(B2,10),2),"/",LEFT(B2,4)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment