Change of label, based on the time

Hello

I have a simple label with the text indicating an hour; I was wondering: if it would be possible to change the time - of the label (which is entered via XML) for the time zone of the current user and if so, how can I get this?

Label

property alias fixtureInfo: fixtureText.text
    property alias timeInfo: timeText.text
    property alias stadiumInfo: stadiumText.text

Header {
                title: qsTr("Time (GMT - 3)")
            }
            Container {
                leftPadding: 20
                rightPadding: 20
                Label {
                    id: timeText
                    multiline: true
                    textStyle.base: bodyStyle.style
                }
            }

XML


        
        Brazil vs Croatia
        17:00PM (Local Time)
        Arena de Sao Paulo
        
    

Thank you

Here are some tips:

to get the name of the current timezonbe, you can ask the CalendarService

mCalendarService.settings().currentSystemTimezone();

Here is a code to get some useful values of the current time

QVariantMap MonitorTime::nowDateTimeInfo() {
    QVariantMap map;
    QDateTime now = QDateTime::currentDateTime();
    QString nowIso = now.toString(Qt::ISODate);
    QString nowUtcIso = now.toUTC().toString(Qt::ISODate);
    // cut the seconds
    nowUtcIso = nowUtcIso.split("T").at(0) + "T"
            + nowUtcIso.split("T").at(1).left(6) + "00Z";
    QString day = nowIso.left(10);
    QLocale locale = QLocale().system();
    QString dayFormatted = locale.toString(QDate::fromString(day, Qt::ISODate),
            bb::utility::i18n::dateFormat(locale,
                    bb::utility::i18n::DateFormat::Medium));
    QString hhmm = nowIso.split("T").at(1).left(5);
    QString timeZone = mConnectedCalendar->currentCalendarTimeZone();
    QString suffix = currentTimeZoneSuffix(now);
    map.insert("weekday", weekdayLocalized(day));
    map.insert("day", day);
    map.insert("dayFormatted", dayFormatted);
    map.insert("hhmm", hhmm);
    map.insert("timeZone", timeZone);
    map.insert("suffix", suffix);
    map.insert("iso", isoDate(day, hhmm, suffix));
    map.insert("isoUTC", nowUtcIso);
    return map;
}

---

QString MonitorTime::currentTimeZoneSuffix(const QDateTime& dateTime) {
    QDateTime dt = dateTime;
    dt.setTimeSpec(Qt::UTC);
    int minutesOffset = dt.secsTo(dateTime) / 3600 * -1;
    QString suffix;
    if (minutesOffset > 0) {
        suffix = "+";
    } else {
        suffix = "-";
    }
    int hoursOffset = abs(minutesOffset) / 60;
    if (hoursOffset < 10) {
        suffix.append("0");
    }
    suffix.append(QString::number(abs(minutesOffset))).append(":");
    minutesOffset = abs(minutesOffset) - (hoursOffset * 60);
    if (minutesOffset == 30) {
        suffix.append("30");
    } else {
        suffix.append("00");
    }
    return suffix;
}

Maybe you get some ideas from the code

the easier way to see what is in the plan using JsonDataAccess to write content to a file

Tags: BlackBerry Developers

Similar Questions

  • How to get the time based on the time zone?

    Hi all

    I try to get timestamp based on the time zone I assign in the computer... for example right now I m CA, if I change the time zone of the computer IS, and use time get Sec.vi, I always get time to CA.

    and not the ACC at EST time... How can I get the time according to the time on my laptop?

    Think I remember vaguely that LV reads this parameter when loading, then try to restart LV after changing the time zone and see if that helps.

  • You are looking for the block CD build based on the time for MPC simulation.vi

    Hello everyone! I'm trying to implement MPC in LabVIEW. I downloaded some code that shows the implementation. My question is in these codes that I see a named block as CD build based on the time for MPC simulation.vi. I tried to find a lot of this block, but I could not... Can someone help me with the problem (exactly under what section I get this block) or can someone tell me how can I give the profile of setpoint for the problem of simulation MPC?

    The associated screws to generate the profile found in:

    C:\Program Files (x 86) \National Instruments\LabVIEW 2011\vi.lib\addons\Control Design\_MPC\Reference profile

    or

    C:\Program NIUninstaller Instruments\LabVIEW 2011\\vi.lib\addons\Control Design\_MPC\Reference profile

    You can look at examples of:

    C:\Program Files (x 86) \National Instruments\LabVIEW 2011\examples\Control and Simulation\Control Design\MPC

    C:\Program NIUninstaller Instruments\LabVIEW 2011\examples\Control and Simulation\Control Design\MPC

    to check the use of these screws

  • Datalogger with options to recover the subset of the log based on the time

    I want to thank this forum for tips so far to fill my LabVIEW software.

    I have a challenge for data logging. I'm supposed to sign about 30 settings every 5 seconds. Some of these parameters are digital (ON / OFF), some are the values of the speed (RPM) and others, the expression of a percentage (%). It should be possible in the future to do a histogram or graph bar certain parameters, for a specific period range field (say the last 5 minutes in a given day). So, indeed, do a checkout from a segment of the total log file.

    My challenge is if I use the text file, as that of the attached VI, can provide the functionality of the data recovery (while the VI is running) in the log file, based on a certain time interval (i.e. recover a section of the log file based on a certain range of time, on demand)?

    The format of the text file is close to what I'm asking, because it lists the time n a column and the other parameters on other columns to enable the next generation of histogram.

    Thank you, friends.

    Hey Maxidivine

    I made a parallel loop in your program that won't ask you a file to search for and request to start and finish datestamp.
    These stamps must be present in the text file before you click on the button Get Data From File.

    The data buffers are accurate to one second, but if I understand correctly you connect every 5 seconds and the program will be
    Auto extend the search to find the next available date corresponding.

    If you set the time of acquisition to 8 seconds, the program will look for the available timestamp in the file text 16 seconds after the entry is necessary, because there is not a date stamp in the file for each second.

    I would like to know if this helps.

    Philippe

  • Based on the time of server request

    Hello

    I send a request to a server. If I don't have an answer, I need to send a request once more after 3 seconds. Like this, I need to check 3 times. If 3 rd time also it fails, I need to put an end to the request by sending a message to the client.

    Please help me how to do this. I don't know how to send a request based on that time too for only 3 times.

    Kelifaoui has

    Study using setInterval() with a counter variable.  The setInterval will take care to call a function every 3 seconds and the counter will this grateful function when three attempts have been made.  You can use clearInterval() to close if the attempt success before the third time.  Details of use are available in Flash diocuments help.

  • How to change template name based on the parameter in bipublisher

    Hi all

    I want to change the model based on the selected report parameter.

    For example: If A is selected it should use a model, if B is selected it should use the B model.





    Thank you
    KSS

    HII,

    can you clarify pls.
    If you have any what example it would help me a lot... I use a model RICH in BIpublisher.

    Published by: André on November 12, 2009 20:10

  • ListView, title change to header based on the stored value.

    Hello

    I'm new to native development, always trying to get a hang of how things are done in QML. I was wondering how it was possible to format the header in the ListView based on the value of the header. For example, the datamodel is sorted by name and status. Status is stored as an integer 0,1,2,3,4,5 in the database. Whenever the ListView displays the headers, I want to show the actual title of the State (for example in progress, completed) instead of display 0 or 1.

    Thank you for your help.

    If... else if... else must have worked well, please send your code.

  • Display different text based on the time of day?

    Hello

    I want to have a msg text showing according to the time zone of the user of the native device. For example, when the user is during the day, it displays "Hello". And when the night time comes, it shows "good evening." Is there that an average muse can achieve this? If so, can you please tell me how? either use the widget or write javascript code by adding the html object? Thank you

    You can have fun with JavaScript date() functions. Search the Web. a lot of info on this around.

    Mylenium

  • How to refresh a single chart based on the time of day

    This site advanced of Muse, HOME | Great American Car Wash, traffic light is programmed to change to red when the business is closed and green when it opens. The code I wrote back the following meta tag:

    < meta http-equiv = "refresh" content = "5" / >

    It refreshes the whole page every 5 seconds. Page Flash as it refreshes is not desirable. My best temporary solution is to change the frequency to 2 minutes. I fixed provisionally for 5 seconds for troubleshooting. It will have the value 30 seconds when it's time to publish the site.

    I used the command "INSERT HTML code" in Muse to add the code. It works as expected, with the exception of the blink of an annoying page to update the traffic lights. Business owner could easily tolerate a traffic light flashing when updating.

    Is there a way to only update the graphics only? Or is there a better way to "automatically update" status of light?

    Thank you.

    "Cincinnati."

    You can try the suggestions mentioned here:

    http://StackOverflow.com/questions/17886578/refresh-part-of-page-div

    http://crunchify.com/how-to-refresh-div-content-without-reloading-page-using-jQuery-and-AJ ax.

    Thank you

    Sanjit

  • I want to schedule tasks intermitant Windows based on the time and date.

    Similar to the function OnTime in Excell...   Driven by my code... no limit time of Task Scheduler options. Or may Iprogramaticaly schedule a task again a time in task schedular as apposed by using its dialog entry forms.  It works too, I wrote a small vba application that could sit there 24/7 active and fire off my task when it is called for, but that looks like a terrible waste of resources

    You can see the rest of the story in the other thread... I just wanted you to know that it is resolved... and thank you

    I am trying to use the Task Scheduler... I get without permission

  • Locking password for blackBerry Smartphones based on the time-out

    Hi, new BB Bold and I have a password and can lock and unlock the phone.  However the phone automatically goes into lock down to 5 minutes.  Even if I set the Options-> the safety time of 1 hour option it hangs still in about 5 minutes.

    What should I do about it?  The ideals?  The store said that I had to take a safety, go back to my computer, clean the phone and restore.  If this does not work I am to get a new phone.  Just bought a few weeks ago.

    Hi and welcome to the forums!

    You could try a battery pull above all

    drastic measures on your part!

    No data will be lost when you do the following: remove the battery while the device is activated. Remplacer replace after one minute, let the device reboot 1-3 min, see if the problem is corrected.
    Thank you

    Bifocals

  • Is it possible to change a filter based on the base image? Or change the algorithms of a filter?

    For example, the filter of patchwork. I want to change so that the lines are not as important, but the color of the mosaic is always there. Is it possible to change the filter file or image to do?

    patchwork.jpg

    Thank you!

    Another option would be to use my script which samples an image and apply colors to a model with deco fill script. It's a little slow to use, as it has made a lot of samples, but you can do interesting things with it. Works on CS6 and higher:

    Script Fill UI - Photoshop CS6

    You need create a clear color model to do this. Here is a sample using a cross stitch pattern:

  • Based on the time in Studio FR

    Hi Experts
    Can you please share me time function to insert reports EN as soon as POSSIBLE please...

    Thanks in advance
    KK

    > for Pacific standard time
    > The eastern standard

    If you do a search on the Date in the help module, it will detail all these information.

  • limit connection based on the time interval

    Hello world.
    I would like to know, how do I restrict a user to connect to the database on specific times? For example, I want the user db to be able to connect after 23:00, of 08:AM. Is this possible?

    Hello

    Not sure if there is a medium setting to do this now, but if not, a logon trigger should do (you can select the users, it applies to).

    Something like:

    create or replace trigger deny_login
      after logon on database
    BEGIN
      IF sys_context('USERENV', 'SESSION_USER') = 'NO_PRIVS' THEN
        IF to_char(SYSDATE, 'hh24') BETWEEN 08 AND 22 THEN
          raise_application_error(-20001,
                                  'Sorry, it is not permitted to logon to the DB at this time as this user');
        END IF;
      END IF;
    END deny_login;
    

    Kind regards

    ADOS

  • Cannot change a form based on the web

    I have an account with A Weber and to modify a web form in Firefox but am unable to as edit text not displayed in Firefox, I contacted the support A Weber and they said to try than another browser and I did and it works, but it does not work in Firefox yet all my cookies and settings are as they should be is there any solution for this I have Windows XP

    URL of affected sites

    http://www.AWeber.com

    Hello Simon,.

    This problem might be caused by an extension of Firefox.

    To ensure that no extension is at the origin of the problems,
    launch Firefox in Mode safe mode by following the instructions in the article questions Troubleshoot Firefox in Safe Mode .

    Kind regards
    Tobbi
    Firefox Support volunteer

Maybe you are looking for

  • How can I speed up my middle mouse button scrolling?

    When I try to scroll down using the middle mouse button, it goes so slow I can't, so I use the scroll bar to the right. It's embarrassing for me. When I reset the button of the mouse on my windows to multiple lines, it allows to scroll too fast for m

  • iPhone 6 does NOT read the SIM cad

    Suddenly after serving more than a year our 6 Iphone does NOT read the sim card. Area of the sim card from the iPhone 6 to our iphone 6 plus the card works well. And the sim card in the iPhone 6plus does NOT register in the iphone 6. So I guess that

  • easy transfer question

    Hi all Have a question: thought I was easy windows xp to xp with the transfer program, but it was actually easy transfer from xp migration to windows 7.  I restored the computer and finally everything is being updated.  Then I discovered that xp vers

  • HP 6700: My iMac does not connect to my printer

    Hello My iMac and HP software are updated. The two devices are connected to my network. My iMac shows two icons of the printer: the HP6700, which shows the driver 2.0 and "printer", which seems generic and contains the driver 4.2, I think. My printer

  • Pavilion dv4 3138tx drivers after reinstalling plain windows 7 Home premium

    My Pavilion DV4 3138tx laptop recovery disk was crushed, and HP did not recovery disk when you bought it. I need to download the windows 7 Home premium of the site "mydigitallife.info' to download the legalized 7 reinstallation windows image. After i