A
A
altertable2020-05-06 13:29:45
Django
altertable, 2020-05-06 13:29:45

How to output only "%H" from TimeField?

in the database table is filled like this - 10:30:00
I need to display separately: hour - 10, min - 30, sec - 00
how can I do this?

in the models file
session_time_start = models.TimeField() # 10:30:00

>>> a = Session.objects.all()[0].session_time_start 
>>> a
datetime.time(12, 30)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-05-06
@vityareabko

print(type(session_time_start))
what will it return if this is done?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question