1# -*- coding: utf-8 -*- 2# Part of Odoo. See LICENSE file for full copyright and licensing details. 3 4import locale 5import time 6import datetime 7 8if not hasattr(locale, 'D_FMT'): 9 locale.D_FMT = 1 10 11if not hasattr(locale, 'T_FMT'): 12 locale.T_FMT = 2 13 14if not hasattr(locale, 'nl_langinfo'): 15 def nl_langinfo(param): 16 if param == locale.D_FMT: 17 val = time.strptime('30/12/2004', '%d/%m/%Y') 18 dt = datetime.datetime(*val[:-2]) 19 format_date = dt.strftime('%x') 20 for x, y in [('30', '%d'),('12', '%m'),('2004','%Y'),('04', '%Y')]: 21 format_date = format_date.replace(x, y) 22 return format_date 23 if param == locale.T_FMT: 24 val = time.strptime('13:24:56', '%H:%M:%S') 25 dt = datetime.datetime(*val[:-2]) 26 format_time = dt.strftime('%X') 27 for x, y in [('13', '%H'),('24', '%M'),('56','%S')]: 28 format_time = format_time.replace(x, y) 29 return format_time 30 locale.nl_langinfo = nl_langinfo 31