Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Timezone Adjustments?
Old 04-24-2005, 01:47 AM Timezone Adjustments?
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
I've looked it up in the php.net documentation, but I didn't see anything that helped me, so I'll ask here...

How do I adjust the time so that it displays the central time zone? It's two hours off. :|
Bloodsyne is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-24-2005, 03:38 PM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Aye, I've just spent the last 10 mins looking at php.net, and I'm still not finding any sensible information on adjusting your timezone. Perhaps others can, but there are so many different functions that I'm not sure which to use (and how to use it correctly).

I'm quite befuddled.
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 05:27 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
On the time() function page there is a function to handle time offsets
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-24-2005, 05:40 PM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
I looked at it, but I have no idea how the heck to use it.
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 06:44 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
PHP Code:
<?php

$time 
time();
$time += (-3600);

/* Change the -5 with any time offset
        -5 : EST
        -6 : CST
        +7 : WAST
   etc.
*/

?>
Just add <offset> * 3600 to the UTC time (mktime() or time() should return UTC time on most servers. If yours does not, then offset the time so it is UTC, then offset again to get where you want), and you have the time in that timezone
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 07:02 PM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Alright, thanks, I'll try that.

That gives me this: 1114362

Is there something I'm missing?
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 07:06 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Make sure your time is a timestamp. If it's not a timestamp, try using strtotime to convert it to a timestamp, then do your modifications, then use date to turn it back to a textual date.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-27-2005, 03:53 AM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Alright, amazingly, I figured out how to use it. Thanks a lot!

Edit: Scratch that, I didn't catch it at first, but it's a whole hour off.

I'm really no good with this time crap.. I don't know why it's so difficult for me to comprehend, but it is. Here's my current code for getting the time:

PHP Code:
                    $time time() + (-3600);
                    
$timestamp strtotime(+0224);
                    
$timef date("g:iA T"$timestamp); 
By the way, I know the first line isn't connected to the rest right now.

If you could take a few seconds, could you give me the code that would give me CST time in that format (g:iA T (timezone doesn't even show up))? At least that way I could read the code and figure it out... otherwise, it's just not clicking in my mind right now, and I don't know why.

Last edited by Bloodsyne; 04-27-2005 at 04:07 AM..
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Timezone Adjustments?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26747 seconds with 12 queries