note 97466 added to datetime.format

From: Date: Wed, 21 Apr 2010 16:04:46 +0000
Subject: note 97466 added to datetime.format
Groups: php.notes 
Request: Send a blank email to php-notes+get-168476@lists.php.net to get a copy of this message
if you want to use e.g. german weekdays you could add the following class as a temporary solution... <?php class DateTimeGerman extends DateTime { public function format($format) { $english = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'); $german = array('Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'); return str_replace($english, $german, parent::format($format)); } } ?> it hasn't anything to do with nice programming but it works if you construct a <?php $dt = new DateTimeGerman(); ?> instead of <?php $dt = new DateTime(); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 90.146.114.67 ---- Manual Page -- http://www.php.net/manual/en/datetime.format.php Edit -- https://master.php.net/note/edit/97466 Del: integrated -- https://master.php.net/note/delete/97466/integrated Del: useless -- https://master.php.net/note/delete/97466/useless Del: bad code -- https://master.php.net/note/delete/97466/bad+code Del: spam -- https://master.php.net/note/delete/97466/spam Del: non-english -- https://master.php.net/note/delete/97466/non-english Del: in docs -- https://master.php.net/note/delete/97466/in+docs Del: other reasons-- https://master.php.net/note/delete/97466 Reject -- https://master.php.net/note/reject/97466 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168476) next »