Ninjakreborn Posted January 30, 2007 Share Posted January 30, 2007 20070129000000 -0500What time setup is this? Quote Link to comment Share on other sites More sharing options...
ober Posted January 30, 2007 Share Posted January 30, 2007 EST... I'm not sure what date/time format that is, but it's obviously indicating GMT -5 hours, which is EST. Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 30, 2007 Share Posted January 30, 2007 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 be20070130191530 (timezone offset) Quote Link to comment Share on other sites More sharing options...
ober Posted January 30, 2007 Share Posted January 30, 2007 I assume the 20 is for 2007YYYYMMDDhhmmss -hhmm Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 30, 2007 Share Posted January 30, 2007 good point ober how stupid of me Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 30, 2007 Share Posted January 30, 2007 Paul - think maybe the 20 is for, oh...2007? :-PThe other 6 0's are likely H:i:s - so it's midnight.(edit: didn't preview, sorry.) Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 30, 2007 Share Posted January 30, 2007 ok ok ok everyone stop having a go at my stupidity please...i am upset enough :) Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 30, 2007 Author Share Posted January 30, 2007 [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 be20070130191530 (timezone offset)[/quote]I thought the 20 was for 2007.Even after reading your description, all I can get is2007 01 13I was thinking01-13-2007 for the datethen the remaing 0191530 was a unixtimestampI 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 2007YYYYMMDDhhmmss -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? :-PThe 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 timeThere, 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 datestrtotime("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. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 30, 2007 Share Posted January 30, 2007 break it into substrings and use mktime();Year, month, day, hour, minutes, seconds.2007 01 29 00 00 00 Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 30, 2007 Author Share Posted January 30, 2007 [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 mktimehttp://us2.php.net/manual/en/function.mktime.phpThat 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 browserspecific? Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 30, 2007 Author Share Posted January 30, 2007 Sorry, that was my lack of reading.After reviewing mktime, it seem's it will handle everything like that behind the scenes.Thank you for the advice. Quote Link to comment Share on other sites More sharing options...
ober Posted January 31, 2007 Share Posted January 31, 2007 >>I am still confused as to what this timezone isI told you what timezone it is and what the offset is and means. What's confusing? Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted February 1, 2007 Author Share Posted February 1, 2007 [quote]Sorry, that was my lack of reading.After reviewing mktime, it seem's it will handle everything like that behind the scenes.Thank you for the advice.[/quote]I had replied up there, it was a misreading, I understood it after re-reading the replies. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted February 1, 2007 Author Share Posted February 1, 2007 I ran into a problem, I was trying something specific to get the date checked. Here is what I triedBased 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? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 1, 2007 Share Posted February 1, 2007 You should use strtotime, not strftime. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted February 1, 2007 Author Share Posted February 1, 2007 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. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 1, 2007 Share Posted February 1, 2007 Did you even read the manual? strtotime does not have the same syntax as strftime. A good idea might be to use a combination of both: [code]$time = strtotime(strftime("%Y%m%d%H%M"));[/code]It should get you a UNIX timestamp. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.