Skip to content

Instantly share code, notes, and snippets.

@HamedMasafi
Created January 7, 2020 08:32
Show Gist options
  • Save HamedMasafi/eb4b4333c429a08ce5a8f7508b4866ae to your computer and use it in GitHub Desktop.
Save HamedMasafi/eb4b4333c429a08ce5a8f7508b4866ae to your computer and use it in GitHub Desktop.
QCalendar and jalali calendar in Qt 5.14
#include <QCoreApplication>
#include <QCalendar>
#include <QDate>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCalendar cal(QLatin1String("jalali"));
qDebug() << "availableCalendars=" << QCalendar::availableCalendars();
QString todayJalali = QDate::currentDate().toString("yyyy-MM-dd", cal);
qDebug() << "Today in jalali calendar=" << todayJalali;
QDate d(1398, 10, 15, cal);
qDebug() << "Date 1398/10/15 in julian calendar=" << d.toString();
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment