On Tue, Jan 14, 2003 at 07:24:56PM +0100, Morten Bo Johansen wrote: > I need to produce a string with this format > > 2003-01-14 15:44+0100 > > but I got problems with the leading zero padding > The line to get the date and time looks like this: > > variable tm = sprintf ("%d-%d-%d %d:%d", 1900 + tm.tm_year, 1+tm.tm_mon, > tm.tm_mday, tm.tm_hour, tm.tm_min); The format string as presented doesn't even output the timezone. At any rate, assuming you give it the correct arguments, the format string you want is "%4d-%02d-%02d %02d:%02d+%05d" > Anyone knows? Jed knows. In the menubar, Go to Help->Unix Man Page. Type sprintf in the minibuf. Hit return. Learn. ~D -- choose death, it lasts longer
Attachment:
pgpdL5Fm5k_FA.pgp
Description: PGP signature