Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97327

How to get timestamp in VS code task?

$
0
0

I'm running small shell commands via tasks in VS code.

Within these commands I need the current timestamp.

Given I'm trying to run something like mkdir ./%date in a task:

{
    "label": "make timestamp dir",
    "type": "shell",
    "command": "mkdir ${workspaceFolder}/%date%",
},

I tried using %date% and %time% but both is not substituted.

Alternatively I did see that VS code allows to call commands with ${command:CommandID}. Therefore I installed a extension that generates a timestamp: https://marketplace.visualstudio.com/items?itemName=jsynowiec.vscode-insertdatestring I tried to use that with ${command:insertDateString.insertTimestamp}:

{
    "label": "make timestamp dir",
    "type": "shell",
    "command": "mkdir ${workspaceFolder}/${command:insertDateString.insertTimestamp}",
},

But that also is not substituted.

I'm out of ideas. How to add a timestamp in a VS code task?


Viewing all articles
Browse latest Browse all 97327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>