I have code:
<?php echo strftime("%Y %B %e, %A")?>
In some languages I get:
2012 junio 3, domingo
I want that first letter of all words would be uppercase (capital), so it would look like:
2012 Junio 3, Domingo
I didn't find any answer in internet, does anybody have an idea? :)
Try echo ucwords(strftime("%Y %B %e, %A"));
echo ucwords(strftime("%Y %B %e, %A"));
ucwords是你的功能: http : //php.net/manual/en/function.ucwords.php
$ php -a
Interactive shell
php > $x = strftime("%Y %B %e, %A");
php > $str = explode(" ", $x);
php > foreach ($str as $i) { print ucfirst($i) . " "; };
2012 June 3, Sunday
php >
Try styling the output like this:
strftime('<span style="text-transform: capitalize;">%Y %B %e, %A</span>')
or
echo '<span style="text-transform: capitalize;">' . strftime('%Y %B %e, %A') . '</span>';
This way you can choose which words to capitalize. In your case ucwords
works I guess, since you want all your words starting with uppercase.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.