Time

Started by
1 comment, last by jfclavette 18 years, 4 months ago
C++ How do I set a variable equal to the date, almost like I want a program that displays the date?
-Mat² §alley©-
Advertisement
#include <iostream>#include <string>#include <time.h>using namespace std;int main(){  time_t curr_time;  time(&curr_time);  string str = ctime(&curr_time);  cout << str << endl;  return 0;}


http://www.codersource.net/cpp_date_time.html
For the sake of standard compliance, use ctime instead of time.h
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style

This topic is closed to new replies.

Advertisement