I was looking in the FAQ's but the topic was pretty unclear. I want to know how to get the date from the system. Can anyone tell me the specific or recommended function to use? I want it in the mm/dd/yyyy format.
Printable View
I was looking in the FAQ's but the topic was pretty unclear. I want to know how to get the date from the system. Can anyone tell me the specific or recommended function to use? I want it in the mm/dd/yyyy format.
http://www.codeproject.com/datetime/datetimedisc.asp
this might be of some use, if you dont feel liek reading a
windows specific function would be GetSystemTime()
do a google search im sure you can prolly acheive something
with that, or maybe time_t
Here are some functions to deal with time, and formatting it in various ways (from the standard <ctime> header): http://cppreference.com/stddate/
You could also just bring it flowers and ask really nicely.
Cheers
That site is kinda iffy. So do i just say, GetSystemTime() and use the time.h library?
Will this work?
example:
Code:#include<iostream>
#include<time.h>
#include<string.h>
usign namespace std;
int main()
{
string Time;
Time=GetSystemTime();
cout<<Time;
cin.get();
return 0;
}
Something to start from. Jostle the format specifier a little. Perhaps "%m/%d/%Y".