Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>time-stamp-updaterNew to Visual Studio Code? Get it now.
time-stamp-updater

time-stamp-updater

A.Matsukura

|
10 installs
| (0) | Free
A VS Code extension that automatically updates time-stamp lines in files, compatible with Emacs time-stamp.el.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

time-stamp-updater

A Visual Studio Code extension that automatically updates time-stamp lines in your files, similar to Emacs' time-stamp.el. This extension detects a time-stamp line near the top of the file and updates it with the current date and time according to your preferred format.

Features

  • Automatically updates a time-stamp line in your files on save.
  • Highly compatible with Emacs time-stamp.el formatting.
  • Customizable detection pattern, format, and search range.

Requirements

No additional requirements.

Extension Settings

This extension contributes the following settings:

  • timeStampUpdater.pattern (default: "Time-stamp:[ \\t]+\\\\?[\"<]+")
    • Regular expression pattern to detect the time-stamp line.
  • timeStampUpdater.start / timeStampUpdater.end
    • Start/end regexp for time-stamp detection (used if pattern is not set).
  • timeStampUpdater.lineLimit (default: 8)
    • Maximum number of lines to search from the top (positive) or bottom (negative).
  • timeStampUpdater.searchFrom (default: "top")
    • Search direction for time-stamp replacement: "top" (from file start) or "bottom" (from file end).
  • timeStampUpdater.count (default: 1)
    • How many time-stamp templates to update in a file (update multiple time-stamps if set > 1).
  • timeStampUpdater.format (default: "%Y-%02m-%02d %02H:%02M:%02S %l")
    • Format string for the time-stamp (see below for details).

Example: Custom Timestamp Line

If you want to update lines like Last change: or Last Modified : with a timestamp, set the following in your settings.json:

"timeStampUpdater.start": "[lL]ast[ -](https://github.com/crimair/time-stamp-updater/blob/HEAD?:[mM]odified|[cC]hange(&:d)?|[uU]pdated?)[ \\t]*:[ \\t]*",
"timeStampUpdater.end": "$"

Example:

Last change: 2025-05-15 00:00:00 matsukura

Notes:

  • The regular expressions for start and end use JavaScript RegExp syntax, which is slightly different from Emacs Lisp. For example, grouping uses (?: ... ) and alternation uses | without extra backslashes.
  • Setting end to $ means "update to the end of the line". This is the recommended way to overwrite the entire timestamp area.
  • If you use .* for end, only the first match will be replaced, and repeated saves may concatenate timestamps.
  • Using \n for end will not work, because each line is processed individually and does not contain a newline character.

With this configuration, the line will be automatically updated on save.

Format String Operators

The following operators are supported in the format string (compatible with Emacs time-stamp.el):

  • %Y : 4-digit year (e.g., 2025)
  • %y : 2-digit year (e.g., 25)
  • %m : month number (01-12)
  • %d : day of month (01-31)
  • %H : hour (00-23)
  • %I : hour (01-12)
  • %M : minute (00-59)
  • %S : second (00-59)
  • %a : abbreviated weekday name (e.g., Mon)
  • %A : full weekday name (e.g., Monday)
  • %b : abbreviated month name (e.g., Jan)
  • %B : full month name (e.g., January)
  • %p : am/pm
  • %P : AM/PM (uppercase)
  • %w : day of week number (0=Sunday)
  • %Z : time zone name (e.g., JST)
  • %z : time zone offset (e.g., +0900)
  • %l : login name
  • %L : full user name
  • %q : unqualified host name
  • %Q : fully-qualified host name
  • %h : mail host name
  • %f : file name without directory
  • %F : absolute file name
  • %% : literal percent character

Modifiers and padding (e.g., %02d, %#A, %:B) are also supported as in Emacs. See Emacs time-stamp.el documentation for advanced usage.

Not implemented or partially supported operators

  • %Z with # modifier (lowercase time zone name)
  • %:z, %_z, %-z, %::z (complex time zone modifiers)
  • %s, %u, %U (legacy: system-name, user-login-name, user-full-name)
  • Locale-dependent month/weekday names
  • Full compatibility for padding, truncation, upper/lowercase, and multiple modifiers

Most common date/time, padding, and basic uppercase/lowercase are supported, but full Emacs compatibility is not guaranteed.

Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.

Release Notes

Users appreciate release notes as you update your extension.

0.0.1

Initial release


Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft