Date Localization - Australian
| From: | Luke Woollard | Date: | Thu, 01 May 2003 05:11:48 +0000 |
| Subject: | Date Localization - Australian | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145898@lists.php.net to get a copy of this message | ||
I need help with displaying an australian version of the current date and
time.
I've set the locale for my application using: setlocale (LC_ALL, 'en');
Here is a class method I am using to return a date/time string
/**
* Displays a human-readable version of a unix timestamp.
*
* @access public
* @param string timestamp A unix timestamp
* @return string
*/
function dateAndTime($timestamp)
{
// Parse input as a unix timestamp and list each part as separate
variable
list($year,$month,$day,$hour,$minute,$second) =
sscanf($timestamp,"%4s%2s%2s%2s%2s%2s");
// Return a formatted date/time according to our preferred locale
return strftime('%c',
mktime($hour,$minute,$second,$month,$day,$year));
}
Here is a sample command with a timestamp as input: echo
dateAndTime('20030430121556');
Here is output from the above command: 04/30/03 12:15:56 PM
NOTE THAT THE DATE AND MONTH NEED TO BE INTERCHANGED!!!!!!!!
Please help, this is driving me nuts.. I dont know how to set the locale
speficically for Australia or if it is even possible with PHP..
> Luke Woollard
> .......................................................
> Programmer / Analyst
> TABORVISION
> luke@taborvision.com
> 03.9886.0881 ext 105
> www.taborvision.com
> .......................................................
>
> This document is confidential and may contain legally privileged
> information. If you are not the intended recipient you must not copy,
> distribute or act in reliance on it. The sender cannot guarantee that this
> email or any attachment to it is free of computer viruses or other
> conditions that may damage or interfere with data, hardware or software
with
> which it might be used. If you have received this document in error,
please
> advise us toll free on 1.800.50.50.42 Australia :: 973.556.1107 USA
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php