- Subject: Re: Leading zero padding in time formats.
- From: Morten Bo Johansen <mojo@xxxxxxxx>
- Date: Tue, 14 Jan 2003 20:51:00 +0100
David Beverly <rain@xxxxxxxxxxxxxxxx> wrote:
DB> 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);
DB> The format string as presented doesn't even output the timezone. At any
DB> rate, assuming you give it the correct arguments, the format string you want
DB> is "%4d-%02d-%02d %02d:%02d+%05d"
Thanks to both you and John for a fast response.
>> Anyone knows?
DB> Jed knows. In the menubar, Go to Help->Unix Man Page. Type sprintf in the
DB> minibuf. Hit return. Learn.
Ah, don't quite work on my system. I am trying to learn but for
a non-programmer it's a slow process. However, it won't be long
before I proudly present my po_mode to the list.
DB> choose death, it lasts longer
;-)
Regards,
Morten
--
"If work was a good thing the rich would have it all and not let you do it."
(Elmore Leonard)
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]