Python Forum
Running Date and Time in SQLITE using Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Date and Time in SQLITE using Python
#1
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
Reply
#2
Please provide enough code to run.
or at least print out value ok k
Reply
#3
(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
Reply
#4
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 209 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Date Time Series Help...Please spra8560 2 352 Feb-01-2024, 01:38 PM
Last Post: spra8560
  need help with data analysing with python and sqlite Hardcool 2 356 Jan-30-2024, 06:49 AM
Last Post: Athi
  Python date format changes to date & time 1418 4 585 Jan-20-2024, 04:45 AM
Last Post: 1418
  python sqlite autoincrement in primary column janeik 6 1,140 Aug-13-2023, 11:22 AM
Last Post: janeik
  Downloading time zone aware files, getting wrong files(by date))s tester_V 9 1,017 Jul-23-2023, 08:32 AM
Last Post: deanhystad
  Formatting a date time string read from a csv file DosAtPython 5 1,250 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  How to see the date of installation of python modules. newbieAuggie2019 4 1,569 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019
Question Running an action only if time condition is met alexbca 5 1,305 Oct-27-2022, 02:15 PM
Last Post: alexbca
  How to change UTC time to local time in Python DataFrame? SamKnight 2 1,596 Jul-28-2022, 08:23 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020