How to Strip Time from Date Time and store in PSQL using Python? -


i have situation want strip time date time object , store in database (psql precisely)

how do ?

>>> print(datetime.now()) 2016-06-28 16:22:30.918715 

what want

2016-06-28 

and store psql database

what best way handle ?

i posting answer cause took me around hour find answer , hope helps someone. best solution of have found

dt = datetime.today() 2016-06-28 16:22:30.918715  dt.strftime('%y-%m-%d') 2016-06-28 

basically psql stores data in type string code dt.strftime('%y-%m-%d') strip off time , return string data type , can store it.


Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -