How to Automatically Insert Formatted Dates in Visual Studio Code

sheikmostafizur

Sheik Mostafizur

Posted on October 12, 2024

How to Automatically Insert Formatted Dates in Visual Studio Code

When writing code or documentation, having the current date formatted correctly can save you time and help keep your projects organized. In Visual Studio Code (VSCode), while there's no built-in functionality for inserting formatted dates like "Oct 12, 2024" directly, there are effective methods to achieve this. In this post, we’ll explore how to insert formatted dates using snippets and extensions in VSCode.

Step-by-Step Guide

Image description

Image description

Image description

    /************   Current Date **************/
  "Insert Current Date": {
      "prefix": "currentDate",
      "body": [
          "${CURRENT_MONTH_NAME_SHORT} ${CURRENT_DATE}, ${CURRENT_YEAR}"
      ],
      "description": "Insert the current date in Oct 10, 2024 format"
  }
Enter fullscreen mode Exit fullscreen mode

How to use it?

  • Go to any file then write currentDate
  • If auto suggestion not work press ctrl+space

Follow me

💖 💪 🙅 🚩
sheikmostafizur
Sheik Mostafizur

Posted on October 12, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related