summaryrefslogtreecommitdiff
path: root/Userland/date.cpp
blob: 951cfb21ccb3985ad0bda612a3cda19597094c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <LibC/time.h>
#include <LibC/stdio.h>

int main(int argc, char** argv)
{
    (void) argc;
    (void) argv;

    time_t now = time(nullptr);
    auto* tm = localtime(&now);
    printf("%4u-%02u-%02u %02u:%02u:%02u\n",
        tm->tm_year + 1900,
        tm->tm_mon + 1,
        tm->tm_mday,
        tm->tm_hour,
        tm->tm_min,
        tm->tm_sec);
    return 0;
}