Last active
June 21, 2020 04:58
-
-
Save vitran96/db80b34224965b5c0e4292b115ab9a2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
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