Search
 
SCRIPT & CODE EXAMPLE
 

CPP

get current date in c++

#include <ctime>
#include <iostream>

int main() {
    std::time_t t = std::time(0);   // get time now
    std::tm* now = std::localtime(&t);
    std::cout << (now->tm_year + 1900) << '-' 
         << (now->tm_mon + 1) << '-'
         <<  now->tm_mday
         << "
";
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: maximum in vector 
Cpp :: how to convert qt string to string 
Cpp :: log base c++ 
Cpp :: fibonacci series in c++ recursive 
Cpp :: c++ short if 
Cpp :: output coloured text in cpp 
Cpp :: how to take user input in a client server program in c++ 
Cpp :: input output c++ 
Cpp :: how to print hello world in c++ 
Cpp :: swap using Function template in c++ 
Cpp :: how to get a random number between two numbers in c++ 
Cpp :: c++ visual studio 19 how to make colord button from code 
Cpp :: capture an entire line C++ 
Cpp :: insert at position in vector c++ 
Cpp :: vs code text in line 
Cpp :: tostring c++ 
Cpp :: compile notepad++ c++ 
Cpp :: access last element in vector in c++ 
Cpp :: HOW TO TURN LINK TO BUTTON IN MVC 
Cpp :: check variable type c++ 
Cpp :: qt label set text color 
Cpp :: c++ vector add only unique elements 
Cpp :: c++ find largest number in array 
Cpp :: default access modifier in c++ in struct 
Cpp :: iterating string in cpp 
Cpp :: cpp mst 
Cpp :: queue implementation using linked list in cpp 
Cpp :: c++ extend class 
Cpp :: max of two elements c++ 
Cpp :: tuple c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =