I am trying to populate a field with the current time. Here is what I tried that did not work:
Start editing
Open Attribute Table
Add Field -> Name: time
Type: Date
Right Click on Field Name (time)
Open FieldCalculator
Parser: Python
Type: Date
Then I basically tried all of these expressions:
time.strftime('%d/%m/%Y')
That gives me the date, not the time
datetime.datetime.now( )
That gave me DATE and TIME. But as soon as I saved the changes, the time disappears.
(If the time would stay there I could do something with the FieldCalculator to populate another column like !time![:x]
)
datetime.timedelta(seconds=0)
That gave me <Null>
.
Am I missing a step or something?
time.strftime('%H:%M')
to get hours and minutes? (Python documentation on strftime)