Insert the current date, time, ISO 8601 string, Unix/epoch timestamp, or any custom Day.js-formatted timestamp directly into the editor.
Perfect for Markdown notes, changelogs, front matter, logs, comments, templates, and distributed-team workflows that need consistent UTC or timezone-aware timestamps.
- Insert date/time with a keyboard shortcut
- Supports date, time, datetime, ISO 8601, Unix timestamp, and custom formats
- Configure a custom format template
- Allows inserting date/time in a different IANA timezone such as
UTC,Europe/Warsaw, orAmerica/New_York - Allows inserting localized month and weekday names
- Insert at the cursor or replace the current selection
- Prompt for one-off custom formats when needed
| Command | Example output |
|---|---|
Insert DateTime |
2026-06-30 14:05:09 |
Insert Date |
2026-06-30 |
Insert Time |
14:05:09 |
Insert Timestamp |
1782821109000 |
Insert Formatted DateTime with iso |
2026-06-30T12:05:09Z |
Custom format YYYY-MM-DDTHH:mm:ssZ |
2026-06-30T14:05:09+02:00 |
Install from the Visual Studio Marketplace, or open the Command Palette and run:
ext install jsynowiec.vscode-insertdatestringOpen the Command Palette and run one of these commands:
| Command | Shortcut | Description |
|---|---|---|
Insert DateTime |
⇧+⌘+I (OS X) Ctrl+Shift+I (Windows/Linux) |
Inserts current date and/or time according to configured format (format) at the cursor position. |
Insert Date |
— | Inserts current date according to configured format (formatDate) at the cursor position. |
Insert Time |
— | Inserts current time according to configured format (formatTime) at the cursor position. |
Insert Timestamp |
— | Inserts current timestamp in milliseconds at the cursor position. |
Insert Formatted DateTime |
⇧+⌘+⌥+I (OS X) Ctrl+Alt+Shift+I (Windows/Linux) |
Prompt user for format and insert formatted date and/or time at the cursor position. The last custom format entered is remembered per workspace using VS Code's workspace context which is separate from the insertDateString.format setting and is not visible in your workspace settings file. |
Reset Workspace DateTime Format Override |
— | Clears the workspace-stored format override, restoring the insertDateString.format setting as the default for Insert Formatted DateTime. |
- Date and time format string (this affects
Insert DateTimeoutput): - Date format string (this affects
Insert Dateoutput): - Time format string (this affects
Insert Timeoutput): - Timezone (applies to all format-based commands; leave empty for local system time):
- Locale (applies to month and weekday-name tokens; leave empty for English):
Configure the default output in your user or workspace settings:
{
"insertDateString.format": "YYYY-MM-DD HH:mm:ss",
"insertDateString.formatDate": "YYYY-MM-DD",
"insertDateString.formatTime": "HH:mm:ss",
"insertDateString.timezone": "",
"insertDateString.locale": ""
}Set insertDateString.timezone to an IANA timezone name to produce timestamps in a consistent timezone regardless of the local system clock. This is useful for distributed teams that need to agree on a shared reference timezone.
{
"insertDateString.timezone": "America/New_York"
}Supported values: Any IANA timezone name (e.g. UTC, America/New_York, Europe/Warsaw, Asia/Tokyo). Leave empty to use local system time.
Affected commands: Insert DateTime, Insert Date, Insert Time, Insert Formatted DateTime.
Unaffected commands: Insert Timestamp always produces a Unix timestamp in milliseconds (UTC by definition). The iso format token always outputs UTC regardless of this setting.
If the configured value is not a valid IANA timezone, a warning is shown and local system time is used as a fallback.
Set insertDateString.locale to a ISO 639-1 locale tag to render month and weekday names in that locale.
{
"insertDateString.locale": "es"
}Supported values: ISO 639-1 (two-letter codes) locale keys supported by Day.js. Leave empty to use English.
Affected tokens: MMM, MMMM, dd, ddd, and dddd use the configured locale verbatim.
Affected commands: Insert DateTime, Insert Date, Insert Time, Insert Formatted DateTime.
Unaffected commands: Insert Timestamp always produces a Unix timestamp in milliseconds. The iso special format always outputs UTC and does not use locale formatting.
If the configured value is not supported, a warning is shown and English is used as a fallback.
Format strings use dayjs token conventions.
- YY - Two-digit year. Examples: 99 or 03
- YYYY - Four-digit year. Examples: 1999 or 2003
- M - Month, without leading zeros. 1 through 12
- MM - Month, with leading zeros. 01 through 12
- MMM - Abbreviated month name. Jan through Dec
- MMMM - Full month name. January through December
- D - Day of the month, without leading zeros. 1 to 31
- DD - Day of the month, with leading zeros. 01 to 31
- d - Day of the week. 0 (Sunday) through 6 (Saturday)
- dd - Minimal day name. Su through Sa
- ddd - Abbreviated day name. Sun through Sat
- dddd - Full day name. Sunday through Saturday
Month and weekday-name tokens use insertDateString.locale when configured.
- H - 24-hour format, without leading zeros. 0 through 23
- HH - 24-hour format, with leading zeros. 00 through 23
- h - 12-hour format, without leading zeros. 1 through 12
- hh - 12-hour format, with leading zeros. 01 through 12
- m - Minutes, without leading zeros. 0 through 59
- mm - Minutes, with leading zeros. 00 to 59
- s - Seconds, without leading zeros. 0 through 59
- ss - Seconds, with leading zeros. 00 to 59
- SSS - Milliseconds, with leading zeros. 000 to 999
- A - AM or PM
- a - am or pm
- Z - UTC offset. Examples: +05:30, -07:00
- ZZ - UTC offset without colon. Examples: +0530, -0700
- X - Unix timestamp in seconds
- x - Unix timestamp in milliseconds
- w - ISO weekday. 1 (Monday) through 7 (Sunday)
- W - ISO week number of year. First week is the week containing 4 January
- WW - ISO week number of year, zero-padded. Examples: 01, 22
- o - ISO week-year (same as
GGGG, provided for compatibility) - GGGG - ISO week-year (standard dayjs token). Same as
YYYYexcept at year boundaries where the ISO week belongs to the adjacent year - iso - Special value: outputs a simplified ISO 8601 string in UTC (e.g.
2013-07-16T20:13:31Z)
- Do - Ordinal day of the month. Examples: 1st, 2nd, 31st
- Year and month:
YYYY-MM(2013-07) - Complete date:
YYYY-MM-DD(2013-07-16) - Complete date and time:
YYYY-MM-DD HH:mm:ss(2013-07-16 20:13:31) - Complete date plus hours, minutes, seconds and UTC offset:
YYYY-MM-DDTHH:mm:ssZ(2013-07-16T20:13:31+01:00)
Yes. Run Insert DateTime or use Shift+Cmd+I on macOS and Ctrl+Shift+I on Windows/Linux.
Yes. Use Insert Formatted DateTime with iso, or configure a custom format and timezone.
Yes. Set insertDateString.format, insertDateString.formatDate, or insertDateString.formatTime using Day.js-style tokens.
- Version 3.0 switched from
date-format-liteto dayjs for date formatting:- Token semantics for
h/hh/H/HHhave changed —HHis now 24-hour (was 12-hour) andhhis now 12-hour (was 24-hour). The default format has been updated. If you use a custom format withhhorHH, please review and update your settings. - Literal-text escape syntax changed:
date-format-liteused"text"or'text'(e.g.'T'); dayjs uses[text](e.g.[T]). If you use literal escaping in your format, update to the bracket syntax. If you want literal square brackets in the output, you need to escape the bracket characters using the same mechanism. For example,[[]produces a literal[.
- Token semantics for
Released under the MIT License.
