0

Is there any way to query date and get timestamp instead of datetime.datetime object in sqlalchemy using python 2.7?

4
  • 1
    Does this answer your question? Convert datetime to unix timestamp in SQLAlchemy model before executing query? Commented Mar 11, 2021 at 12:52
  • ? dt = datetime.datetime(2021, 3, 11) dt.timestamp() 1615449600 Commented Mar 11, 2021 at 15:15
  • I'm getting an Attribute Error. Commented Mar 11, 2021 at 15:34
  • You will need to show the code you are running to get a useful answer. Please include it as an UPDATE to your original question. Commented Mar 11, 2021 at 18:04

1 Answer 1

0

This seems to have worked for me.

import time
time.mktime(data.date.timetuple())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.