Skip to content
  • How to convert Jalali date to Gregorian date

    Solved General and Desktop calendar date
    7
    0 Votes
    7 Posts
    2k Views
    SavizS
    @hskoglund this did indeed work. and the results are correct: "2025/01/04" Thank you for your help. Here is the code if anyone is curious: void jalaliToGregorian(int year, int month, int day) { QCalendar calendar(QCalendar::System::Jalali); QDate gregorianDate = calendar.dateFromParts(year, month, day); qDebug() << QString("%1/%2/%3") .arg(gregorianDate.year(), 4, 10, QChar('0')) .arg(gregorianDate.month(), 2, 10, QChar('0')) .arg(gregorianDate.day(), 2, 10, QChar('0')); }
  • 0 Votes
    1 Posts
    484 Views
    No one has replied
  • 0 Votes
    10 Posts
    3k Views
    L
    @mrjj I have moved forward from calling my saved dates to receive the following: Read Value: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] for key: dates (one for each date saved) when adding if(success) { console.log(JSON.stringify(value)) } I can also read the saved dates in the format of: [{"date":"2018-10-01T21:17:00.926"},{"date":"2018-10-02T12:00:00.000"},{"date":"2018-10-03T12:00:00.000"},{"date":"2018-10-06T12:00:00.000"},{"date":"2018-10-07T12:00:00.000"},{"date":"2018-10-08T12:00:00.000"}] now how would I determine these dates are saved in my calendar to add the marker? I have tried adding a property bool to the marker so the read value equals isMarked = true yet this either marks every date on the calendar or none at all depending on how I am working this?!? How would I convert the JSON string to individual date reads?
  • Filter by Date on a SQLITE

    Solved General and Desktop sqlite date qdate qstring query
    4
    0 Votes
    4 Posts
    7k Views
    cxamC
    @the_ @SGaist Hi, I managed to solve it on my own by encoding the date to a JulianDate and using juliandate on my db so it's much easier to compare and so. Thanks for your help.
  • Change language of date

    Unsolved QML and Qt Quick qml date language
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • setHours() do not work

    Solved QML and Qt Quick javascript date qml
    3
    0 Votes
    3 Posts
    3k Views
    A
    Luckily I found solution myself :) According to http://doc.qt.io/qt-5/qtqml-javascript-hostenvironment.html#javascript-environment-restrictions "global" object cannot be modified inside a JavaScript function. In this cause that code was part of onClicked property. Proper code: onClicked : { var working_time = calendarForDate.chosen_Hour; // local variable working_time.setHours( (calendarForDate.chosen_Hour.getHours() + 1)%24 ); // now JavaScript can modify that calendarForDate.chosen_Hour = working_time; console.log(calendarForDate.chosen_Hour.getHours()); // one cannot modify global object, but that's perfectly fine hoursField.text = calendarForDate.chosen_Hour.getHours() // now it works as intended } Thanks for you attention.