0
votes

Good Day! I have this problem I have a code like this

tree_model = self.env['hr.reception'].search([('create_date','=',date_from)])

the date_from is only a date only parameter while the column create_date is datetime column I only want to format the create_date as date only format is this possible just like in postgres

(create_date::date)

Thanks for the Help

2

2 Answers

0
votes

You can achieve it using date() method which will return the date format instead of datetime.

For example:

1. datetime.now() will result in datetime format.   
2. datetime.datetime.now().date() will result in date format.
0
votes

Try : create_date.strftime('%Y-%m-%d')