Sublime Forum

Update code for ST3

#1

Hello everybody,

I am new Sublime text, love it !
Can someone please update this plugin to make it work with ST3 ?

Thanks

[code]# -- coding: utf-8 --

from datetime import datetime
import sublime_plugin

class TimestampCommand(sublime_plugin.EventListener):
“”“Expand isoD, now, datetime, utcnow, utcdatetime,
date and time
“””
def on_query_completions(self, view, prefix, locations):
if prefix in (‘isoD’, ‘now’, ‘datetime’):
val = datetime.now().strftime(’%Y-%M-%dT%H:%M:%S’)
elif prefix in (‘utcnow’, ‘utcdatetime’):
val = datetime.utcnow().strftime(’%Y-%M-%dT%H:%M:%S’)
elif prefix == ‘date’:
val = datetime.now().strftime(’%Y-%M-%d’)
elif prefix == ‘time’:
val = datetime.now().strftime(’%H:%M:%S’)
else:
val = None

    return (prefix, prefix, val)] if val else ][/code]
0 Likes

#2

Where is the problem? This works perfectly fine for me.

You might also want to check out packagecontrol.io/packages/InsertDate.

0 Likes