Home Download Buy Blog Forum Support

ST2: Snippet for dates/time

ST2: Snippet for dates/time

Postby ordonezalex on Thu Feb 07, 2013 11:45 pm

I have looked around the unofficial documentation (http://docs.sublimetext.info/en/latest/extensibility/snippets.html) and the forums for a solution to this, have found nothing.

As an Advanced Placement Computer Science student (Java), I often type dates (dd.Mon.yyyy) for JavaDoc purposes (course requirement).
I have made (or adjusted) every other snippet I could possibly need right now, except this one.
Ideally, the snippet would work similarly to the class snippet. This snippet uses a TM variable:
Code: Select all
to fill the class name.

In the unofficial documentation,
Code: Select all
files are referred to, but I could not find any or know where to place one (and if I could or did, I would probably not know how to set a variable to the current date/time).

Any suggestions for a (or directions to an already existing) solution will be greatly appreciated.

- Alex Ordonez

EDIT: Changed title to specify ST2.
Posts: 1
Joined: Thu Feb 07, 2013 11:34 pm

Re: ST2: Snippet for dates/time

Postby quodlibet on Fri Feb 08, 2013 11:29 am


I use @FichteFoll's InsertDate:

with the following command in my `User/Default.sublime-commands`:
Code: Select all
{ "caption": "InsertDate: ISO Date", "command": "insert_date", "args": {"format": "%Y-%m-%d"} },

If you need to do something more complex you will need to write a simple plugin in Python. (Not too much trouble to do; I'm not a programmer and I managed it.)

Hope this helps,
Posts: 576
Joined: Sat Jun 18, 2011 5:53 pm

Return to Technical Support

Who is online

Users browsing this forum: duggum, Exabot [Bot], Google [Bot] and 27 guests