I'm calling trim() (or more specifically, ltrim because these never generate right padding AFAIK), on the final strftime() call, you know, just inside the return call...
Re: timeformat annoys me...
« Reply #15, on April 5th, 2012, 02:57 PM »
I'm now thoroughly confused. You wanted to deal with the left spacing on the number, and suggested using trim(), I just suggested a variation on that which didn't use %e, nothing more.
For cases where there's an extra space in the middle of the string, you're still stuffed either way, whether you use ltrim() or trim(), aren't you?
My goal was initially to fix %e to return no padding. However, I don't really care that %e returns an extra space when HTML will deal with it. It's not a big deal... So, in the meantime I figured I should just call ltrim() on the final string (" 2 Décembre"). Do you understand what I mean...?
There is no magic st/nd/rd in PHP AFAIK.
<?php
// Prints something like: Monday 8th of August 2005 03:12:46 PM
date('l jS \of F Y h:i:s A');
?>dgudgeon at example dot com 14-Jul-2011 05:04
If moving from date() to strftime() to support additional languages, you may miss the ordinal suffix format option date('S'). Workaround this by adding an extra modifier (%O).
<?php
function my_strftime ($format, $timestamp)
{
$format = str_replace('%O', date('S', $timestamp), $format);
return strftime($format, $timestamp);
}
?>Is there not an actual linguistic equivalent in French for 2nd? I always thought there was.
And sadly there isn't a good way around this one - normally it's not a huge problem because most of the time we only have _1 and _n strings in English which will naturally be overridden in other languages. I don't think you can get around it, unless you drop it in English entirely and just leave it in other languages if they want to do so.
Yay, dates are just as much of a shit to cope with as timezones are!
Consider this: April 1 - that's mostly how the Americans write it, and it's wrong, because it should really be April 1st, never mind the implied but missing 'the' in the middle that you mention.
But the English get it wrong too. We tend to write 1 April or 1st April, but that's linguistically wrong too - it's really '1st (of) April' with the implication of 'day' being in there.
Fortunately most people aren't anal enough to care about this and don't really notice it when it's 1 April or April 1 with or without the suffix, it's only those of us who *really* put in the attention to detail that would even notice, let alone do anything about it.
(For the record, it's something I'd like to see done right too, but I didn't know enough about how other languages did it to make a judgement call on how it should be done)