TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTOPHER BUTLER
from: KURT KUZBA
date: 1997-06-29 05:39:00
subject: Date/Time

CB>   Is there an easy way to get the date/time as an ASCII
CB>   string?   eg:
CB>   "22-06-1997, 2:06pm"
   Yes. It is in the ANSI C standard time library.
#include 
#include 
class Time_Date   {
public:
   friend ostream &operator<<(ostream &o, Time_Date &tdc)
   {   time_t T = time(&T);   o << ctime(&T);   return o;   };
};
int main(void)
{
   char a;
   Time_Date td;
   cout << td << flush;
   cin >> a;
   return 0;
}
> ] I am Solo of Borg, and I've got a bad feeling about this....
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.