Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 02-27-2004, 02:46 AM   #1 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Adjusting date() function for time zones

I'm writing a script for a guy who wants current Pacific date and time displayed, but his server in on the East coast. He's on a virtual hosting account so I can't adjust the time settings on the server.

I'm using
Code:
$this_date = date("D M j, Y, g:i A")
Which produces something like:
Fri Feb 27, 2004, 6:33 AM

Is there a way to adjust this for the 3 hour time difference or should I be using a different function? I thought about just using time(), then subtracting 10800 seconds from it and converting it into a formatted date like the one above, but I'm not sure how to do the conversion part.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote
Old 02-27-2004, 02:55 AM   #2 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Nevermind, I should have just tried it before I asked.
Code:
$p_time = time() - 10800;
$this_date = date("D M j, Y, g:i A",$p_time);
Works perfect.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 04:30 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting