php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61338 'strftime' error when 'setlocale(LC_ALL, 'da_DK');'
Submitted: 2012-03-10 09:04 UTC Modified: 2012-03-10 19:21 UTC
From: claus at marcussen dot eu Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.10 OS: Linux srv142 2.6.26-2-vserver-am
Private report: No CVE-ID: None
 [2012-03-10 09:04 UTC] claus at marcussen dot eu
Description:
------------
'strftime' don't work correct when 'setlocale(LC_ALL, 'da_DK');' are done.

Test script:
---------------
	$Dato1 = '2012-04-21';
	$Dato2 = '2012-04-22';
	$Dato3 = '2012-04-23';
	$DatoStr1 = strtotime($Dato1);
	$DatoStr2 = strtotime($Dato2);
	$DatoStr3 = strtotime($Dato3);
	
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr1)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr1 . '<br/>';
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr2)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr2 . '<br/>';
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr3)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr3 . '<br/>';

	echo '<br/>';
	
	setlocale(LC_ALL, 'da_DK');
	$Dato1 = '2012-04-21';
	$Dato2 = '2012-04-22';
	$Dato3 = '2012-04-23';
	$DatoStr1 = strtotime($Dato1);
	$DatoStr2 = strtotime($Dato2);
	$DatoStr3 = strtotime($Dato3);
	
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr1)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr1 . '<br/>';
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr2)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr2 . '<br/>';
	echo htmlentities(ucfirst(strftime('%A d. %d.', $DatoStr3)), ENT_QUOTES, "UTF-8") . '  ' . $DatoStr3 . '<br/>';


Expected result:
----------------
The same result (excl. language).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-10 09:18 UTC] claus at marcussen dot eu
Test source here : http://fredericia-skakforening.dk/Test/datotest.php

It seems like it is weekend days that can be done.
 [2012-03-10 12:50 UTC] claus at marcussen dot eu
-Status: Open +Status: Closed
 [2012-03-10 12:50 UTC] claus at marcussen dot eu
Sorry, me mistake. Not "UTF-8"
 [2012-03-10 19:21 UTC] cataphract@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 01:01:31 2024 UTC