General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old January 1st, 2003, 09:37 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
converting GMT to EST??

im using the following coding to put a sentence at the bottom of my pages that tells users when it was last updated:

PHP Code:
// Get the modification date of this PHP file
    
$timestamps[] = @getlastmod();
    
$timestamps[] = @filemtime("include/all.inc");
    
// latest of all of the included files is real Last-Mod date
    
$timestamp max($timestamps);
    
    
$tsstring gmdate("l, F jS, Y - G:ia T"$timestamp);
    
    
// Check if the client has same page cached
    
if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
        
$tsstring "HTTP/1.1 304 Not Modified";
    }
    
// or else inform the user agent what is our last mod date
    
else {
        
$tsstring "Last-Modified: " $tsstring;
    } 


its displaying everything in GMT format (so when it really is 10:30PM and i just updated its really saying itslike 3:15AM....) how do i fix that?
__________________
-Alexander

Reply With Quote
  #2  
Old January 2nd, 2003, 04:53 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Trying adding the difference between GMT and EST.

Hadley

Reply With Quote
  #3  
Old January 2nd, 2003, 04:57 AM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
to do that do i subtract 5 from the end of the $tsstring var?

Reply With Quote
  #4  
Old January 2nd, 2003, 06:07 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
You need to subtract 5 hours from $timestamp, which is measured in seconds. (ie. $timestamp =- 5 * 3600)

Hadley

Reply With Quote
  #5  
Old January 2nd, 2003, 05:44 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
i inserted the line "$timestamp =- 5;" and now its saying the year is 1969...

PHP Code:
// Get the modification date of this PHP file
    
$timestamps[] = @getlastmod();
    
$timestamps[] = @filemtime("include/all.inc");
    
// latest of the files is real Last-Mod date
    
$timestamp max($timestamps);
    
    
$timestamp =- 5;
    
    
$tsstring gmdate("l, F jS, Y - G:ia "$timestamp);
    
    
// Check if the client has same page cached
    
if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
        
$tsstring "HTTP/1.1 304 Not Modified";
    }
    
// or else inform the user agent what is our last mod date
    
else {
        
$tsstring "Last-Modified: " $tsstring;
    } 


thanks--

p.s., i also tryed "adding" 5 and then it told me the date was JAnuary 1st, 1970...which is fine except its 33 years ago

Last edited by Vasarab69 : January 2nd, 2003 at 05:46 PM.

Reply With Quote
  #6  
Old January 3rd, 2003, 02:02 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Hmmmm. That's odd. Could you please give me the value of $timestamp before and after modification?

Thanks,

Hadley

Reply With Quote
  #7  
Old January 3rd, 2003, 02:48 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
sure...ive just updated to make sure the time would be both syncronized....

before:

Last-Modified: Thursday, January 2nd, 2003 @ 16:02pm
.....
after:

Last-Modified: Wednesday, December 31st, 1969 @ 11:00am
.....

the first one would almost be fine (other than the fact that it would be like 45 mins off), if it werent being displayed in military time... once again, the code for the 'before' example is below:

PHP Code:
// Get the modification date of this PHP file
    
$timestamps[] = @getlastmod();
    
$timestamps[] = @filemtime("include/all.inc");
    
// latest of the files is real Last-Mod date
    
$timestamp max($timestamps);

    
$tsstring date("l, F jS, Y \@ G:ia "$timestamp);
    
    
// Check if the client has same page cached
    
if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
        
$tsstring "HTTP/1.1 304 Not Modified";
    }
    
// or else inform the user agent what is our last mod date
    
else {
        
$tsstring "Last-Modified: " $tsstring;
    } 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > converting GMT to EST??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway