DEV Community

Sheik Mostafizur
Sheik Mostafizur

Posted on

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

AI Agent image

How to Build an AI Agent with Semantic Kernel (and More!)

Join Developer Advocate Luce Carter for a hands-on tutorial on building an AI-powered dinner recommendation agent. Discover how to integrate Microsoft Semantic Kernel, MongoDB Atlas, C#, and OpenAI for ingredient checks and smart restaurant suggestions.

Watch the video 📺

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay