Skip to content

tsubakimoto/dotnet-timestamp

Repository files navigation

dotnet-timestamp

NuGet status

dotnet-timestamp is a .NET global tool that prints timestamps and converts them across time zones from the command line. The installed command name is dtstamp.

Install

dotnet tool install -g dotnet-timestamp

Usage

  • Show the current time (defaults to UTC and round-trip format):
     dtstamp now
  • Use a custom format and time zone (C# standard format strings, DateTimeOffset time zone IDs):
     dtstamp now --format "yyyy-MM-dd HH:mm:ss" --timezone Asia/Tokyo
  • List available time zones on the system:
     dtstamp timezone --list
  • Convert a timestamp between time zones:
     dtstamp timezone convert --datetime "2024-09-01T12:00:00" --from UTC --to America/New_York --format "yyyy-MM-dd HH:mm:ss zzz"
  • Convert a datetime to Unix timestamp (milliseconds since 1970-01-01 00:00:00 UTC):
     dtstamp unix --datetime "2024-09-01T12:00:00Z"
  • Get the current Unix timestamp:
     dtstamp unix
  • Convert a Unix timestamp to datetime:
     dtstamp unix convert 1725192000000
  • Convert a Unix timestamp to datetime with custom format:
     dtstamp unix convert 1725192000000 --format "yyyy-MM-dd HH:mm:ss"

The default command runs now.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages