delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/19/14:25:07.2

Message-Id: <199903191924.OAA04299@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: "Carlos M. Matos" <cmmatos AT banet DOT net>
Date: Fri, 19 Mar 1999 19:22:27 +0000
MIME-Version: 1.0
Subject: Re: How do I get the time and date?
CC: djgpp AT delorie DOT com
X-mailer: Pegasus Mail for Win32 (v2.42a)
Reply-To: djgpp AT delorie DOT com

On 19 Mar 99 at 6:06, Carlos M. Matos wrote:

> Hi!
> 
> First of all let me thank you in advance for all of you who will respond to
> this message.  Thanks to all of you.
> 
> I am writting a program in C++ using djgpp version 2.02.  I need to know how
> to get the time and the date from
> the system.  I am writting a checking account program which keeps track of
> the time and date when a checking transaction has been done.  I will be
> waiting for your response.  I have a dead line to turn in this program by
> this comming monday March 29, 1999 and today is Friday, March 19, 1999.
> Once again thank you for your responce.

This isn't really a djgpp question, it's a general language 
question.  I don't know about C++, but in C you'd use `gmtime' 
or `localtime' to convert the value returned by `time' to a 
readable format.  Here's a copy of the example from the 
documentation of `gmtime':

     time_t x;
     struct tm *t;
     time(&x);
     t = gmtime(&t);

On the other hand, if you just want an ASCII representation of 
the time, look up `ctime' and `asctime'.

-- 
George

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019