?
Solved

PHP date function - removing time

Posted on 2003-03-06
2
Medium Priority
?
193 Views
Last Modified: 2006-11-17
Hi,

I'm using the date function to return the date into a news page I'm making (nothing big, just some feeds I like that I'm still working on - http://chris.clook.net/news/syn.php ), and the time on the server is five hours ahead of my local time. Here's the code I've used for the time http://chris.clook.net/news/syn.php.txt - what can I use to take five hours off? I tried many things with the letter Z (from the PHP manual) subtracting 18000 seconds (five hours), but I haven't gotten anything to work. Does anybody know what I'm doing wrong?

Thanks, Chris
0
Comment
Question by:christo87
[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 Comments
 
LVL 1

Accepted Solution

by:
splishsplash earned 200 total points
ID: 8085482
Here's a couple ways to do it:
<?
echo date("l, F d Y h:i a",strtotime ("-18000 seconds"));
echo date("l, F d Y h:i a",time()-18000);
?>
0
 

Expert Comment

by:alfarod
ID: 8086914
Here you are:

date("M-d-Y H:i:s", mktime(date("G")-5, date("i"), date("s"), date("m"), date("d"), date("Y")));

The mktime function do exactly what you need whenever you want to change time and date.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

764 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