Additionally I included the pytz lib to support named timezones. There are a bunch of examples how to use them.
I might look a bit complicated at first sight, but people using Sublime Text should get its usability soon enough.
Here is the default keymap as example:
- Code: Select all
[
// Insert datetime using default format text
{ "keys": ["f5"], "command": "insert_date" },
// Insert datetime using the specified format
{ "keys": ["ctrl+f5", "ctrl+d"], "command": "insert_date", "args": {"format": "%Y-%m-%d"} },
{ "keys": ["ctrl+f5", "ctrl+t"], "command": "insert_date", "args": {"format": "%X"} },
{ "keys": ["ctrl+f5", "ctrl+i"], "command": "insert_date", "args": {"format": "iso"} },
{ "keys": ["ctrl+f5", "ctrl+u"], "command": "insert_date", "args": {"format": "%x %X %Z", "tz_out": "UTC"} },
// Prompt for user input, "format" would behave as default text
// and insert the datetime using that format string
{ "keys": ["alt+f5"], "command": "insert_date", "args": {"prompt": true} }
]
Link: https://github.com/FichteFoll/sublimetext-insertdate