Community mailing list archives

community@mail.odoo.com

Re: Problem with datetime field (Odoo9)

by
Mustafa Babiker El-Siddig Mustafa Hamad
- 01/25/2016 02:35:06

Yes this is true.  I faced the same issue with the Arabic language.

Regards

On Jan 25, 2016 9:34 AM, "Martin Trigaux" <mat@odoo.com> wrote:
Hello,

This depends of the locales installed on your machine.

 >>> import datetime
 >>> datetime.datetime.strptime('2016-01-19 14:00:00', '%Y-%m-%d 
%H:%M:%S').strftime('%A')
'Tuesday'
 >>> import locale
 >>> locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
'fr_FR.UTF-8'
 >>> datetime.datetime.strptime('2016-01-19 14:00:00', '%Y-%m-%d 
%H:%M:%S').strftime('%A')
'mardi'

It depends a bit of what the code you downloaded is doing but it looks 
like it set the locale to Spanish somewhere.


On 25/01/16 02:27, Dominic RC wrote:
> selected_day = datetime.datetime.strptime('2016-01-19 14:00:00',
> '%Y-%m-%d %H:%M:%S').strftime('%A')
>
> when I execute the code from odoo, selected_day = 'martes', but if I
> execute the code from a simple python script selected_day =
> 'Tuesday', does this have anything to do with selected template language
> or any configuration for translated terms in odoo?

-- 
Martin Trigaux
Odoo (Formerly OpenERP)
https://odoo.com
https://github.com/mart-e

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe