get current date in c 2b 2b

Solutions on MaxInterview for get current date in c 2b 2b by the best coders in the world

showing results for - "get current date in c 2b 2b"
Brevyn
03 Feb 2017
1#include <ctime>
2#include <iostream>
3
4int main() {
5    std::time_t t = std::time(0);   // get time now
6    std::tm* now = std::localtime(&t);
7    std::cout << (now->tm_year + 1900) << '-' 
8         << (now->tm_mon + 1) << '-'
9         <<  now->tm_mday
10         << "\n";
11}
Andrea
13 Oct 2018
1#include <string>
2#include <sstream>
3#include <iostream>
4
5time_t t = time(0);   // get time now
6struct tm * now = localtime( & t );
7
8ostringstream osTime;
9osTime << (now->tm_year + 1900) <<
10   (now->tm_mon + 1) <<
11   now->tm_mday <<
12   "\n";
13
14cout << osTime.str();
queries leading to this page
cpp program to get todays datehow to display current date and time c 2b 2bget system time c 2b 2bhow to get current time and date in c 2b 2bget system date c 2b 2bget current date c 2b 2bget current date and time c 2b 2bc 2b 2b get datedisplay system date in c 2b 2bc 2b 2b get date classdate today in c 2b 2bc 2b 2b program to get current datehow to get current date from c 2b 2bc 2b 2b today datec 2b 2b get current datec 2b 2b system datec 2b 2b current date and timedate today c 2b 2bget date in c 2b 2bc 2b 2b get current time and dateget current date in c 2b 2bc 2b 2b current datehow to print current date in cppc 2b 2b get system timec 2b 2b get system datehow to get today in cppc 2b 2b get current system timehow to get present date in c 2b 2bdate function in c 2b 2b to return current datecurrent date and time c 2b 2bcurrent date and time in c 2b 2bhow to get current date and time in c 2b 2bc 2b 2b get current date qdateget todays date c 2b 2bget date c 2b 2bhow to get current date in c 2b 2bwrite a c 2b 2b program to display the current date and timecurrent date in c 2b 2btime c 2b 2b geting current datedisplay current date and time c 2b 2bhow to display current date and time in c 2b 2bcurrent date time c 2b 2bcurrent date c 2b 2bget current date and time in cppget actual date c 2b 2bcpp get now datetimeget current date in cpphow to get the current date and time in c 2b 2bget current system time c 2b 2bget current date c 2b 2bget current time and date c 2b 2bget current date in c 2b 2b