diff options
| author | Raphael Collet <rco@openerp.com> | 2016-09-02 15:58:39 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2016-09-02 17:28:12 +0200 |
| commit | 9e64f9f9514194d74e166b032add8511182f2677 (patch) | |
| tree | 5086710c04c6b923be18a6d1d97b3f0f3a2a9c4a /odoo/tools/win32.py | |
| parent | 11812b0b9e82b2b1b9041d8250ce01e7b4a5f7ee (diff) | |
[REF] openerp: move `openerp` to `odoo`
Diffstat (limited to 'odoo/tools/win32.py')
| -rw-r--r-- | odoo/tools/win32.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/odoo/tools/win32.py b/odoo/tools/win32.py new file mode 100644 index 00000000000..9445ba857f5 --- /dev/null +++ b/odoo/tools/win32.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import locale +import time +import datetime + +if not hasattr(locale, 'D_FMT'): + locale.D_FMT = 1 + +if not hasattr(locale, 'T_FMT'): + locale.T_FMT = 2 + +if not hasattr(locale, 'nl_langinfo'): + def nl_langinfo(param): + if param == locale.D_FMT: + val = time.strptime('30/12/2004', '%d/%m/%Y') + dt = datetime.datetime(*val[:-2]) + format_date = dt.strftime('%x') + for x, y in [('30', '%d'),('12', '%m'),('2004','%Y'),('04', '%Y')]: + format_date = format_date.replace(x, y) + return format_date + if param == locale.T_FMT: + val = time.strptime('13:24:56', '%H:%M:%S') + dt = datetime.datetime(*val[:-2]) + format_time = dt.strftime('%X') + for x, y in [('13', '%H'),('24', '%M'),('56','%S')]: + format_time = format_time.replace(x, y) + return format_time + locale.nl_langinfo = nl_langinfo |
