Source File: date.cpp

#include <iostream>
#include <ctime>
#include <cassert>
#include <fmt/core.h>

int main(int argc, char* argv[]) {
  std::string format{argv[1]};
  char buffer[1024] = {0};
  time_t t;
  struct tm *tmp = nullptr;

  t = time(NULL);
  tmp = localtime(&t);
  assert(tmp != NULL && "Invalid time.");

  strftime(buffer, sizeof(buffer), format.c_str(), tmp);
  fmt::println("{}", buffer);
}