suppresing zero in date with # doesn't work in openbsd

Started by hs, October 02, 2009, 08:05:37 PM

Previous topic - Next topic

hs

> (date (date-value) 0 "%a %#d %b %Y")

"Sat #d Oct 2009"

> (date (date-value) 0 "%a %-d %b %Y")

"Sat -d Oct 2009"

> (date (date-value) 0 "%A %-d. %B %Y")

"Saturday -d. October 2009"



newlisp 10.1.5 on OpenBSD 4.5

cormullion

#1
Doesn't seem to work on MacOS X either. But you can use %e for the day of the month:


(date (date-value) 0 "%a %e %b %Y")
;-> "Sat  3 Oct 2009"

Lutz

#2
It works on Win32 using "%#d" and on FreeBSD and UBUNTU Linux using "%-d" as written in the manual. On OpenBSD, SunOS/Solaris and Mac OS X use the "%e" as shown by cormullion.



newLISP internally uses the C function strftime() for formatting dates. The format characters offered on different platforms differ. Use "man strftime" on Unix platforms to consult the man page for your implementation.



The newLISP manual only shows formatting characters found on all platforms. There are many more format characters and platform/locale specific extensions. Here a link to a typical Unix man page:



http://opengroup.org/onlinepubs/007908775/xsh/strftime.html">http://opengroup.org/onlinepubs/0079087 ... ftime.html">http://opengroup.org/onlinepubs/007908775/xsh/strftime.html



I will add the "%e" form to the manual as it seems to be popular on Unixes.