How to insert current date time in vscode?

前端 未结 7 1749
旧时难觅i
旧时难觅i 2020-12-24 01:27

Does anyone know of a way that I can insert the current date & time in a visual studio code by snippets?

I have looked docs but did not get any information abou

7条回答
  •  执念已碎
    2020-12-24 01:47

    As of Jan 2018 (release 1.20) you can use these new snippet environment variables.

    Your example above would look like this:

    "File Header": {
        "prefix": "header",
        "description": "Output a file header with the file name and date",
        "body": [
            "title: $TM_FILENAME",
            "date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE
                $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
        ]
    }
    

提交回复
热议问题