0

Trying to create a timestamp snippet in VS Code that produces yyyy-MM-ddThh:mm:ssZ.

Tried so far:

$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE","T","$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND","Z" but the commas place each section on a new line.

2021-06-27
T
08:57:03
Z

How do I get the "T" and "Z" characters inline here?

1 Answer 1

1

You have to do two things:

  1. Put the whole thing on one line - the ,'s are seen as line breaks.
  2. Wrap each variable in ${....} so that they work properly with the other charcters T and Z right next to them. Otherwise the variables cannot be interpreted properly. So:

"${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}Z"

Sign up to request clarification or add additional context in comments.

1 Comment

There it is! Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.