H
H
hey_umbrella2021-07-15 17:34:14
Python
hey_umbrella, 2021-07-15 17:34:14

How to get time and date?

How do I get the time in minutes and seconds and the date? So far, only the date is displayed.

now = datetime.datetime.now()
timereg = local_date.date()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-07-15
@hey_umbrella

dir(now)

['__add__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', ' __init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__sizeof__', '__str__' , '__sub__', '__subclasshook__', 'astimezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fold', 'fromordinal', 'fromtimestamp', 'hour', ' isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond', 'min', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', 'strptime', 'time', 'timestamp', 'timetuple', 'timetz' , 'today', 'toordinal', 'tzinfo', 'tzname', 'utcfromtimestamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year']year']year']

время в минутах и секундах
.minute and .second respectively

V
Vadim, 2021-07-15
@Viji

now.second
now.minute
now.hour
etc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question