Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::endl;
- #include "string"
- using std::string;
- #include <time.h>
- #include <sstream>
- string nowTime(void)
- {
- char nowTime[50];
- time_t ttime=time(NULL);
- tm *now=gmtime(&ttime);
- strftime(nowTime, 50,"%c", now);
- string str_time = (string) nowTime;
- return (str_time +" GMT");
- }
- int main()
- {
- string strOut="Date: "; //Sun, 18 Oct 2012 10:36:20 GMT
- cout<< (strOut+=nowTime())<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement