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.
csharp // Creating a variable first:
DateTime now = DateTime.Now;
Console.WriteLine(now);
// Without creating a variable:
Console.WriteLine(DateTime.Now);
// Creating a variable first:
DateTime now = DateTime.Now;
Console.WriteLine(now);
// Without creating a variable:
Console.WriteLine(DateTime.Now);
erlang io:format("~p~n", [calendar:local_time()])
io:format("~p~n", [calendar:local_time()])
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
csharp,
erlang, or
cpp
There are 15 other solutions in
additional languages (
clojure,
fantom,
fsharp,
go ...)