Python Forum

Full Version: Running Date and Time in SQLITE using Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello i want to make my date and time continuous running in my database but my code wont work.

date = str(datetime.datetime.fromtimestamp(k).strftime('%b %d, %Y  %I:%M:%S %p'))
hope someone can help me. Smile
Please provide enough code to run.
or at least print out value ok k
(Jul-16-2017, 06:30 PM)Larz60+ Wrote: [ -> ]Please provide enough code to run.
or at least print out value ok k

Good day,

here is the code:
k = time.time()
date = str(datetime.datetime.fromtimestamp(k).strftime('%b %d, %Y %I:%M:%S %p'))


thanks hope you could help me Smile
This returns:
Output:
'Jul 16, 2017 10:06:40 PM'
what were you expecting?
Also, you should read the help section on ow to post.
you are requested to include a snippet that runs or (should run) standalone.
also, Use code tags
and very importantly, include full error tracebacks