#include#include int main() { QDate date = QDate::currentDate(); QString dateString = date.toString("d-MMMM-yyyy"); qDebug() << dateString; return 0; }
#includeThis code takes a date string in the "year-month-day" format and converts it to a QDate object. It then formats the date as "day of the week, abbreviated month name day, year". The output would be something like "Wed, Oct 27, 2021". These examples use the Qt library, specifically the QtCore module.#include int main() { QDate date = QDate::fromString("2021-10-27", "yyyy-MM-dd"); QString dateString = date.toString("ddd, MMM d, yyyy"); qDebug() << dateString; return 0; }