Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How do datetime fields work in Odoo?

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
technicalquickstartTechnicalQuickstart
1 Svar
236 Visninger
Avatar
Abraham Ismael Torales Salazar (aits)

I want to know how Odoo manages the different timezones and date format for the Backend and PDFs


Version: 19


Related forum post: Format Dates in PDF based on Customer Timezone and Language

0
Avatar
Kassér
Avatar
Abraham Ismael Torales Salazar (aits)
Forfatter Bedste svar

Backend

Datetime fields shown in the backend consider the timezone set in your device (ex. the computer you are working on). 

Timezone in Computer
Backend field
Mexico City, Mexico
Tokyo, Japan

The date and time format is taken from the user language:
Language
Setting
Spanish (Latin America) / Español (América Latina)
English (US)

💡
Odoo saves the datetime field value in UTC time, but when you see it in Odoo, the time is "converted" based on your device timezone and with the user language format.


When using filters, you should put your specific time, and Odoo will look for the field raw value (in UTC).



You can also do some other configurations using Studio, like showing the month in numbers or name, or choosing whether or not to show hours or seconds.


PDF

When we add a datetime field to a PDF Report using the "/" command, the time shown considers the user timezone when downloading the PDF.

The date and time format is taken from the user language

💡
This means that you may have a timezone set in your computer, and another in your user, and you may see different times between the backend and the PDF. For the PDF, the computer timezone doesn't matter, only for the backend.

This also gives us the possibility of changing the user's timezone and/or language to match the one from the person we want to send this PDF to.



Examples:

User Language
User Time zone
Result in the PDF Report
Spanish (Latin America) / Español (América Latina)
Mexico City, Mexico
Spanish (Latin America) / Español (América Latina)
Tokyo, Japan
English (US)
Tokyo, Japan
English (US)
Mexico City, Mexico

PDF (Advanced)

If you edit the source code of the PDF Report, you will see that the field was added with a t-field.

In case we use t-out/t-esc instead of t-field, the PDF will show the time in UTC, ignoring any language format we talked about earlier.
 
If you want to format the datetime, you could do it as follows:
For showing only date using t-field or t-out:
<span t-field="doc.x_studio_datetime" t-options="{'widget': 'date'}"/>
For custom date and time format using t-out or t-esc:
<span t-out="doc.x_studio_datetime.strftime('%d/%b/%Y %I:%M %p')"/>

Date components

Time components

Code Meaning
%Y Year (4 digits)
%y Year (2 digits)
%m Month (zero-padded)
%B Month name
%b Abbreviated month name
%d Day of month (zero-padded)
%e Day of month (space-padded) (Unix only)
%j Day of year
Code Meaning
%H Hour (24-hour)
%I Hour (12-hour)
%p AM / PM
%M Minute
%S Second
%f Microseconds

Week / Weekday

Quick preset

Code Meaning
%A Weekday name
%a Abbreviated weekday
%w Weekday number (0=Sunday)
%u Weekday number (1=Monday)
%U Week number (Sunday first)
%W Week number (Monday first)
Code Meaning
%x Locale date
%X Locale time
%c Locale date & time


💡
For standard reports, user timezone still applies, but language format may be linked to partner_id in the QWeb Code in t-lang attribute.

<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>

⚠️
Be careful when editing the PDF code. Incorrect modifications may cause errors when generating or downloading the PDF. For best practices and detailed guidance, please refer to your Odoo Advisor.


Artificial Intelligence

For AI fields, if you add a prompt specifying a certain hour/time, it will be set in UTC. But when you see it in the backend, it will be shown in your device timezone. Example:

Prompt
Result in Odoo Backend for Mexico City timezone

You could also take other datetime fields for the AI prompt
Prompt
Result in Odoo Backend


Extra: contacts timezone

By default, contacts are generated with the timezone of the user that creates it. 
You can see the timezone for each contact by showing the field using Studio.
Moreover, you can also add the field that shows the difference between UTC and the selected timezone for that contact.

1
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Format Dates in PDF based on Customer Timezone and Language Løst
technical quickstart Technical Quickstart
Avatar
1
nov. 25
230
Explaination of Odoo domain filter with simple example Løst
technical quickstart
Avatar
Avatar
2
okt. 25
33700
How do I connect the Epson TM-T88VII to Odoo?
quickstart Quickstart
Avatar
Avatar
2
okt. 25
972
How to Set Customer-Specific Product Names Løst
quickstart Quickstart
Avatar
1
nov. 25
1480
✅ Odoo E-commerce: How to discriminate deliveries based on the type of clients
quickstart Quickstart
Avatar
0
aug. 25
1483
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now