How to Define Current Date and Time C++

C++ has a class (library) for current date and time .The Ctime class provides the current time and date (as set in the system ). Convert that time arguments in string and simple print them .

Source Code

#include <iostream>
#include <ctime>
using namespace std;

int main( )
{
   time_t now = time(0);
   char* dt = ctime(&now);
   cout << " The LEP Developers uplaod this Program On \n \n  " << dt << endl;
}

Output of the Program

Current Date and Time C++

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment