Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

get user time & date

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

get user time & date

Postby RobbieC255 » Mon Oct 01, 2012 5:13 am

Hi there, I've been looking for a solution for this for ages and I'm getting really desperate...

I need to get the date and time of the local users computer and put them into a variable that I can check...

I can do this in javascript:

Code: Select all
<script type="text/javascript">
var localuserdate = new Date()
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write((localuserdate.getDate()) + (" ") + (monthname[localuserdate.getMonth()]))
</script>


but I cannot then create a string from this that I can use in the php. I need to be able to store the variable in the session rather than write it to the page.

I know this sounds weird, but I need this page to display different info based on what the user has their clock set to...

Can anybody help me?

Thanks
RobbieC255
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Oct 01, 2012 5:04 am

Re: get user time & date

Postby kyle04 » Mon Oct 01, 2012 1:21 pm

You may need to use an ajax type function.
see :
http://www.w3schools.com/php/php_ajax_database.asp
kyle04
New php-forum User
New php-forum User
 
Posts: 94
Joined: Sat Jul 07, 2012 1:36 pm

Re: get user time & date

Postby seandisanti » Tue Oct 02, 2012 7:56 am

kyle04 wrote:You may need to use an ajax type function.
see :
http://www.w3schools.com/php/php_ajax_database.asp

Yes, ajax is the way to go if you need to update part of the page after it's rendered.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.