Message-ID: <36118D7D.9BC37287@montana.com> Date: Tue, 29 Sep 1998 19:46:37 -0600 From: bowman Reply-To: bowman AT montana DOT com X-Mailer: Mozilla 4.5b2 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: tonyblaha AT juno DOT com, "djgpp AT delorie DOT com" Subject: Re: newbie: strftime References: <19980929 DOT 140919 DOT 9735 DOT 0 DOT tonyblaha AT juno DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit tonyblaha AT juno DOT com wrote: > > I'm having trouble with the strftime() function in time.h. > I've copied the example directly from libc.inf: > But I can't get it to work. The example is a little confusing, in that is doesn't mention that t needs to be filled out. time_t current_time; struct tm* t; char buf[100]; current_time = time(NULL); // get the current system time t = localtime(¤t_time); // adjust for local parameters strftime(buf, 100, "%B %d, %Y", &t); // format it to your taste puts(buf); // and print it note that 'localtime' or 'gmtime' return a pointer to a static buffer that they maintain.