Skip to content

Instantly share code, notes, and snippets.

@vitran96
Last active June 21, 2020 04:58
Show Gist options
  • Save vitran96/db80b34224965b5c0e4292b115ab9a2a to your computer and use it in GitHub Desktop.
Save vitran96/db80b34224965b5c0e4292b115ab9a2a to your computer and use it in GitHub Desktop.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <sstream>
#include <chrono>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
long long timestamp = 31363200000;
auto millis = std::chrono::milliseconds(timestamp);
auto secs = std::chrono::duration_cast<std::chrono::seconds>(millis);
millis -= std::chrono::duration_cast<std::chrono::milliseconds>(secs);
time_t rawTime = secs.count();
tm timeInfo = *localtime(&rawTime);
// stringstream sstream;
cout << put_time(&timeInfo, "%V") << endl;
cout << put_time(&timeInfo, "%U") << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment