Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I return the time that's showing on my box using PHP?

Posted on 2015-01-08
3
Medium Priority
?
80 Views
Last Modified: 2015-01-08
When I do this:

echo date("g:i a");

I get 7:06 PM. Looks great! But the time on my computer is 12:06 PM.

I'm running this script from my localhost, and since I'll have users all over the place, I didn't want to set my default time zone for this particular function. I just want to post the same time that's sitting on their computer on my site.

How?
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 40538559
Linux systems set the local hardware clock to GMT 0.  You Have to use the time zone to get local time at the server.  You have to use javascript to get the local time in the client's browser.  None of this is your choice.
http://php.net/manual/en/function.date-default-timezone-set.php
0
 

Author Comment

by:brucegust
ID: 40538827
Thanks, Dave!

Found a Javascript clock that works great!

Rock on!
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40538841
You're welcome.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question