Create a Date object representing the current date and time. Print it out.
If you can also do this without creating a Date object you can show that too.
cpp Qt 4.xQDate now = QDate::currentData();
qDebug() << now.toString();
#include <QDate>
#include <QDebug>
int main()
{
QDate now = QDate::currentData();
qDebug() << now.toString();
}
cpp time_t date = time(0);
cout << ctime(&date);
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
time_t date = time(0);
cout << ctime(&date);
return 0;
}
Submit a new solution for
cpp
There are 17 other solutions in
additional languages (
clojure,
csharp,
erlang,
fantom ...)