Skip to content
Snippets Groups Projects
Commit 23341bb1 authored by Bruce Cowan's avatar Bruce Cowan
Browse files

Date and time

parents
No related branches found
No related tags found
No related merge requests found
[Core]
name = DateTime
module = datetime
[Documentation]
description = Functions to do with dates and times
[Python]
version = 3
from datetime import datetime
from errbot import BotPlugin, botcmd
class Datetime(BotPlugin):
"""Functions to do with dates and times"""
@staticmethod
def _get_date_time(fmt):
dt = datetime.now()
return dt.strftime(fmt)
@botcmd
def date(self, message, args):
return "The date is " + self._get_date_time('%x')
@botcmd
def time(self, message, args):
return "The time is " + self._get_date_time('%X')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment