Jump to content

timezone


Ninjakreborn

Recommended Posts

[quote]EST... I'm not sure what date/time format that is, but it's obviously indicating GMT -5 hours, which is EST[/quote]
Thank you for the attempt.

atleast the gmt part makes sense

[quote]dont know what the 20 at the start is but the numbers that follow are year (07) month (01) and day (29) and rest of the zeros are hrs(00) minutes(00) and seconds(00)

so if it was today and now(ish uk time) it would be

20070130191530 (timezone offset)[/quote]
I thought the 20 was for 2007.


Even after reading your description, all I can get is
2007 01 13
I was thinking
01-13-2007 for the date
then the remaing 0191530 was a unixtimestamp
I am still confused as to what this timezone is, or how I can work with it in php, thank you for the attempt

[quote]I assume the 20 is for 2007

YYYYMMDDhhmmss -hhmm[/quote]
That is what I was thinking, that was about all I could get out of it.


[quote]good point ober how stupid of me[/quote]
You tried

[quote]Paul - think maybe the 20 is for, oh...2007? :-P
The other 6 0's are likely H:i:s - so it's midnight.
(edit: didn't preview, sorry.)[/quote]
Good point, thanks for the insight.


So with all of that said, in order to work with this date, in php.

(For instance, I need to take a look at the current time
There, we have the current time.

$date = strtotime(time());
Now we have the current time.
So from here I need to convert the other time into unix, so I pass that date
strtotime("20070129000000 -0500");
Then I can do calculations, I need to do some mathematics with this.


[quote]start="20070129000000 -0500" stop="20070129010000 -0500"
start="20070129110000 -0500" stop="20070129113000 -0500"[/quote]
There are hundreds more, these are the format's I have to work with.

So I need to just convert these values to a unix timestamp all togehter, then I can transfer them into any date I want, and do calculations, or is that -0500 going to cause problems transfering it to a timestamp?

Thank you so far for all the feedback, it is greatly appreciated and helpful.
Link to comment
Share on other sites

[quote]break it into substrings and use mktime();
Year, month, day, hour, minutes, seconds.
2007 01 29 00 00 00[/quote]
Ok, thanks for the input.

After looking up mktime
http://us2.php.net/manual/en/function.mktime.php
That is just what I need.
Substr, will be easy since all of them are the same length.

Last thing, do I need to take into account the -0500 or does mktime work independent on that, or is browser
specific?
Link to comment
Share on other sites

I ran into a problem, I was trying something specific to get the date checked.  Here is what I tried

Based on hte above formate I showed you
[code]<?php
$time = strftime("%Y%m%d%H%M");
if ($att['START'] < $time && $att['STOP'] > $time) {
echo "Got you";
}
?>
[/code]
In this situation $att['START'] holds the start time and $att['STOP'] holds the stop time, in the format that I presented to you a minute ago.  I don't think it's possible in this specific situation for me to be able to change the format in order to test.  I was hoping to change the $time to match that of that format, so I can compare them.

This is not working, is there something I am doing wrong, or would this be proper.  If this is the proper way to do it, then chances are it's something else messing up and not the calculations.  Can someone help me with this real quick?
Link to comment
Share on other sites

Still not working.

I am trying to get the current time (which is time), and run the calculations to find out which one is which.
However it's not coming back with the message, I don't understand if my calculations are wrong, or if it's something else not going right.
So that would be proper calculations to find out.
Based on the start time and stop time having "20070201141500 -0500" this format.  I use the following code
[code]<?php
$time = strtotime("%Y%m%d%H%M");
function startElement($parser, $name, $att='') {
global $open_tags;
global $current_tag;
$current_tag = $name;
if ($att['START'] < $time && $att['STOP'] > $time) {
echo "Got you";
}
if ($format = $open_tags[$name]){
        switch($name){
            case 'PROGRAMME':
            break;
        }
    }
}
?>[/code]
I am 100% sure that the att start and stop have the proper information I echo'd them out, I just need it to find the one that matches the start/stop time.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.