I am using c++ and is there an method i can use to format a date into the following form 06/07/02 which is the month, day and year??
I am using c++ and is there an method i can use to format a date into the following form 06/07/02 which is the month, day and year??
Well what is the information as you get it?
Are you using a Date class or just a string. If either, how is the information formatted?
If its a class, look into the (global) operator<< that is associated with it.
If its a string, look into string manipulation.
i would like to use <ctime> becuase i need the date from the computer is this even possible??
Here's one way.
Code:time_t time_now; char s[9]; time_now = time(NULL); strftime(s,sizeof(s),"%m/%d/%y",localtime(&time_now)); cout << s << endl;
Thanks a lot
it works perfectly