Re: [PHP] strftime silliness

2012-04-11 Thread Tim Streater
On 11 Apr 2012 at 01:47, Geoff Shang ge...@quitelikely.com wrote: 

 On Wed, 10 Apr 2012, Tim Streater wrote:

 I want to format a date/time using a 12 hour representation of the time
 part. I can do this with, say, %d %b %Y %l:%M %p, where the first time
 format specifier is the lower-case L. But, this gives me a leading space
 in the case that the hour is less than 12. I don't want this space.
 Anyone know of an simple way to avoid it? There appears to be no
 specifier to do this. Of course, I can call strftime twice, once for the
 date portion and once for the time portion, trimming the latter, but
 that seems clumsy.

 You can use %-l to achieve this.  You could also use %-I as this will also
 drop leading zeros if present.

 I forget where I read about this.  I'm almost certain that it was *not* in
 any PHP documentation.

Ah - thanks. My post wasn't a complete waste of time after all then. I ended up 
using date(). But is %-l officially supported?

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] strftime silliness

2012-04-10 Thread Tim Streater
I want to format a date/time using a 12 hour representation of the time part. I 
can do this with, say, %d %b %Y %l:%M %p, where the first time format 
specifier is the lower-case L. But, this gives me a leading space in the case 
that the hour is less than 12. I don't want this space. Anyone know of an 
simple way to avoid it? There appears to be no specifier to do this. Of course, 
I can call strftime twice, once for the date portion and once for the time 
portion, trimming the latter, but that seems clumsy.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] strftime silliness

2012-04-10 Thread Geoff Shang

On Wed, 10 Apr 2012, Tim Streater wrote:

I want to format a date/time using a 12 hour representation of the time 
part. I can do this with, say, %d %b %Y %l:%M %p, where the first time 
format specifier is the lower-case L. But, this gives me a leading space 
in the case that the hour is less than 12. I don't want this space. 
Anyone know of an simple way to avoid it? There appears to be no 
specifier to do this. Of course, I can call strftime twice, once for the 
date portion and once for the time portion, trimming the latter, but 
that seems clumsy.


You can use %-l to achieve this.  You could also use %-I as this will also 
drop leading zeros if present.


I forget where I read about this.  I'm almost certain that it was *not* in 
any PHP documentation.


HTH,
Geoff.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] strftime

2004-02-17 Thread Lorderon
Hi All,

I'm using the next code:

?
setlocale(LC_TIME,he);//returns Hebrew_Israel.1255
echo strftime(%A);//I see only question marks: ??? ?
?

The browser encoding is set on Windows-1255..
what's the problem?

-thanks, Lorderon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] strftime()

2001-05-23 Thread Jon Yaggie

Okay here is what I am trying


strftime(%A, %B %e, %Y %H:%M:%S, $last);


I have looked now at the manual and stared in amazement but it seems not to recognize 
%e at all.  What i get is this


Wednesday, May , 2001 12:44:08


Am i doing soemthing wrong??  %d works.