HomeThe ClassicsMicro

An ISO 8601 Date Snippet For VS Code

Published: Updated:

I use this VS Code snippet to get granular times for my post’s front matter. Note that the +02:00 is my timezone SAST—use your own timezone. There’s no ${CURRENT_TIMEZONE} unfortunately. UPDATE 17 November 2024: There is ${CURRENT_TIMEZONE_OFFSET}, actually

"ISO Date": {
    "prefix": "iso8601",
    "description": "Outputs an iso8601 date (YYYY-MM-DDTHH:MM:SS+02:00)",
    "body": "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}${CURRENT_TIMEZONE_OFFSET}"
}