Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use Date () with GMT Brazil (GMT - 03:00) ??
Forum Update on Monday, May 27th 2025

How to use Date () with GMT Brazil (GMT - 03:00) ??

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 355 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mayron
    wrote on last edited by
    #1

    I'm using:

    Timer {
    interval: 500; running: true; repeat: true
    onTriggered: date.text = Qt.formatDateTime(new Date(), "dd/MM/yyyy")

            }
    
    1 Reply Last reply
    0
    • H Offline
      H Offline
      HiddenNetwork
      wrote on last edited by
      #2

      What exactly is the issue here?

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mayron
        wrote on last edited by
        #3

        I want the time in GMT - 03:00 (Brazil) but the time comes in GMT - 00:00

        KroMignonK 1 Reply Last reply
        0
        • M Mayron

          I want the time in GMT - 03:00 (Brazil) but the time comes in GMT - 00:00

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by KroMignon
          #4

          @Mayron You have to set locale to do this:

          Timer {
              property var locale: Qt.locale("br_BR")
              interval: 500; 
              running: true;
              repeat: true
              onTriggered: date.text = new Date().toLocaleString(locale, "dd/MM/yyyy")
          }
          

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          3
          • M Offline
            M Offline
            Mayron
            wrote on last edited by
            #5

            @KroMignon thanks, this solves my problem

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved