Date: 08/15/00
- Next message: Marcel Huber: "[PHP] clibpdf 2 and php3"
- Previous message: Adrian Teasdale: "Re: [PHP] PHP/MySQL developer available"
- In reply to: scottrus <email protected>: "[PHP] display users local time"
- Next in thread: scottrus <email protected>: "Re: [PHP] display users local time"
- Reply: scottrus <email protected>: "Re: [PHP] display users local time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Why not just do this with JavaScript?
Here is a script which displays what you are after:
<SCRIPT language=JavaScript>
<!-- Begin
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
var oneDate = new Date()
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getFullYear();
year = myyear;
myhours = mydate.getHours();
ampmhour = (myhours > 12) ? myhours - 12 : myhours;
ampm = (myhours >= 12) ? ' PM' : ' AM';
mytime = mydate.getMinutes();
myminutes = ((mytime < 10) ? ':0' : ':') + mytime;
if(myday == 0)
day = " Sunday, ";
else if(myday == 1)
day = " Monday, ";
else if(myday == 2)
day = " Tuesday, ";
else if(myday == 3)
day = " Wednesday, ";
else if(myday == 4)
day = " Thursday, ";
else if(myday == 5)
day = " Friday, ";
else if(myday == 6)
day = " Saturday, ";
if(mymonth == 0) {
month = "January ";}
else if(mymonth ==1)
month = "February ";
else if(mymonth ==2)
month = "March ";
else if(mymonth ==3)
month = "April ";
else if(mymonth ==4)
month = "May ";
else if(mymonth ==5)
month = "June ";
else if(mymonth ==6)
month = "July ";
else if(mymonth ==7)
month = "August ";
else if(mymonth ==8)
month = "September ";
else if(mymonth ==9)
month = "October ";
else if(mymonth ==10)
month = "November ";
else if(mymonth ==11)
month = "December ";
// End -->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
<!--//
document.write(day + month);
document.write(myweekday + ", " + year);<!---------------------- THIS LINE
CHANGES ----->
// -->
</SCRIPT>
</BODY></HTML>
Hope this helps you out.
Ade
inovica.com
----- Original Message -----
From: <scottrus <email protected>>
To: php general <php-general <email protected>>
Sent: Monday, August 14, 2000 4:58 PM
Subject: [PHP] display users local time
> Greets all -
>
> I seem to be missing something obvious. I want to display the date/time
according to the users local
> settings. Best as I can see I need to know two vars to do this, the local
users LANG and the TZ they are
> in.
>
> Does the browser pass this info in the header somewhere were php can read
it? I don't want to hard code
> in to display the time / date in any one region.
>
> Once I know the LANG and the TZ I know I can use the setlocale(),
strftime(), and other date / time
> functions to manuplate the date / time in to what I want. I'm just missing
where to get the users local
> settings from...
>
> Thanks for any help.
>
> --
> Scott
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Marcel Huber: "[PHP] clibpdf 2 and php3"
- Previous message: Adrian Teasdale: "Re: [PHP] PHP/MySQL developer available"
- In reply to: scottrus <email protected>: "[PHP] display users local time"
- Next in thread: scottrus <email protected>: "Re: [PHP] display users local time"
- Reply: scottrus <email protected>: "Re: [PHP] display users local time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

