Strtotime Missing A Zero In Minutes
I am working with strtotime. The following problem occurs when using this function:
View Complete Forum Thread with Replies
Related Forum Messages:
How Many Minutes
im trying to work out how many minutes have past and how many remain since the last datetime stamp... does anyone know of any pre-existing functions for this before I reivent the wheel?
View Replies !
Using Strtotime()
Lets say I have a variable $time = 'Apr 30 2007 7:00AM'. Is there a function that I can use or a way of using the strtotime function to see if that variable $time is between the hours of 7am and 7pm?
View Replies !
Strtotime
I am trying to compare 2 dates, so that if a post is older that 90 days the user is not allowed to edit it. i am storing the post date in mysql in datetime field (2007-04-21 10:53:07). My question is how to user strtotime function to compare the NOW() date&time with the stored one, so if greater that 90 days return true.
View Replies !
A Bug With Strtotime
Something seems to be wrong with the strtotime function in PHP5. I've created a staff resourcing database, which is used to assign staff to projects on a weekly basis. The database stores assignments against a week ending date, which is derived using: PHP Code: $week = date('Y-m-d',strtotime('Sunday')) This works fine, $week is set to the current week ending date (Sunday) using this. However, I also create $nextweek and $lastweek using: PHP Code: $nextweek = date('Y-m-d',strtotime('next sunday',strtotime($week))); $lastweek = date('Y-m-d',strtotime('last sunday',strtotime($week))); This has also been working fine, until we got to week ending Sunday 30th October. For some reason, when $week = 2005-10-30, $nextweek becomes 2005-10-05, which is a Saturday. I've tried replacing the 'next Sunday' with '+7 days', but this returns the same date. Is this a bug? Am I missing something?
View Replies !
Strtotime &
I've got a question and was hoping someone could offer some assistance. I've got this simple line in a test file. PHP Code: echo date("Y-m-d", strtotime("next Monday")); Here's my results using different versions of PHP:PHP 4.4.7: 2007-11-04PHP 5.1.2: 2007-11-05PHP 5.2.3: 2007-11-05 Todays date is November 03, 2007 (2007-11-03).
View Replies !
Strtotime()
<?php $current = date ("F", strtotime("now")); $next = date("F", strtotime("next month")); //or try "+1 month" echo $current.'...'.$next; ?>
View Replies !
Run A Php Script Every 5-10 Minutes?
I have done with a script which will parse a website's xml format file and save(create own file name) that data into my server.... So, now i want to do a script that will run every 10 to 20 minutes that will run/execute my parser program becuase that website which provide me that xml data will update constantly. I have ask one off my friend and he tell me that i can run that php script with CORN and Telnet,and i have try it but cannot.
View Replies !
Time + 10 Minutes
$ganja=date("D dS M h:i A"); Assuming the above produced the following . Tue 02nd Jan 11:55 PM How do i add 10 minutes to it to produce this ? . Wed 03rd Jan 00:05 AM
View Replies !
Run A Script Every X Minutes
Computer 1 sends every 10 minutes a file to Computer 2. This Computer 2 is actually a web hosting service and i don't have a full control. I want to run a script on this Comp2, that will check every 30 minutes, if the file exist and its timestamp is no older than 30 minutes. If it's older, then sends me a notification email (in case if Computer 1 freezes). All ok, but how can i run the script every X minutes?
View Replies !
Problem With Strtotime
I am stucked with strtotime to convert date earlier than 1970 into time. Is there any other way to convert older dates between 1900-1970 into time?
View Replies !
StrToTime () Issue
I'm using strtotime to get the timestamp for midnight. I have a statistics script for my pagecounter that displays hits since midnight. I also display the number of hours and minutes passed since midnight. $start = strtotime ('today 00:00'); $timepassed = date ('H:i', time () - $start); The weird part is at 11.30 AM it says 12 hrs and 30 minutes have passed. I tried adding GMT+1 like so: $start = strtotime ('today 00:00 GMT+1'); because I suspect the fact I'm in Holland is the reason for the miscalculation. But this format is refused by strtotime. (-1) Does anyone know a) whether this is indeed the problem, and b) how to fix it. Preferrably not alone for me here, but in suc a way anyone around the globe would have a correctly working script if they'd use mine. The php page for strtotime pointed me to a link at gnu.org where the syntax for it apparantly is listed, but I get a no such page error.
View Replies !
Strtotime And Cron
I've got a db of events which have dates attached to them which have been created using strtotime(). They don't have any time.. just the date. I've got a script which gets today's date using strtotime("today"). I use this as a comparison to find events which happen today. This works fine when I call the script from a URL, however when I called the php file from a cron job... the strtotime("today") creates values which are different each time. Are there any thoughts on what could be causing this? Firstly, I was wondering if the cron job was somehow using a different timezone to me (I'm On GMT). How do I explicitly tell php to use GMT.. .but then again.. this should matter too much, because I jsut want to date not the time! It also wouldn't account for the changing values of strtotime("today"). Just out of interest, does php4 and php5 handle strtotime("today") differently? I'm just wondering if cron is using the correct version of php?
View Replies !
Strtotime Question?
I have a string that looks like (a series of them) 1 Sep 2007 21:06:11 2 Sep 2007 13:45:31 2 Sep 2007 13:45:31 3 Sep 2007 01:40:42 and I want to go strto time on it any ideas its return -1 right now so I know somethings wrong.
View Replies !
Date Strtotime
i am trying to right a date into the mysql database but when i get the date from the html form and do strtotime on it it goes to an invalid date (by this i mean it is not the date i entered in the html form so for example 22-06-2007 changes to 28-11-2027).
View Replies !
Remove 0 From Strtotime?
Like every other blog in the world, I have mine displaying the date and time of each entry. Right now this is what I'm using: echo date('h:ia', strtotime($r[date])); My latest entry's time is displayed as 07:56pm. How do I remove the 0 when the hour is a single digit?
View Replies !
Strtotime(date('m/d/Y'))
does the following code give the correct time:?strtotime(date('m/d/Y')) or do I need to use : strtotime(date('d/m/Y'))? I tried to find out which way the month and day work, but can't seem to find anything that will tell me.
View Replies !
Strtotime() Pre-1970
if I code $birth = strtotime(Ƈ April 1950'); then $birth = -1, I guess that this is because time "began" on 1st Jan, 1970. (although I seem to remember a few good times before that). So, what's the easiest way to find out how many days old I am (exactly, please, not just taking 1 April 1970 and adding 20 *365, which does not account for leap years?
View Replies !
Strtotime Failure
I don't know how I should input date + time into a strtotime function (i'm a total noob) so I tested this: <? $d=01; $M=01; $y=1970; $h=01; $m=01; $s=01; echo "$d $M $y $h:$m:$s"; echo strtotime("$d $M $y $h:$m:$s"); ?> I get as echo strtotime '-1', wich means the strtotime has a failure. Can anybody explain me why? Or can anybody tell me how I can make a strtotime function that puts a timestamp in the database depending on the date and time inserted in a textbox? (one textbox or one textbox to insert the day, another to insert the year,...) I should be able to change a format like (for example) this : 01-02-1990 00:00:00 (midnight) into a timestamp. so dd-mm-yyyy hh:mm:ss (or something else just to make it work)I'm clueless.
View Replies !
Strtotime With Days
On this - "next Thursday" is that next thursday or the next thursday ie: on wed will it show tomorrows time or the next week? PHP Code: <?php echo strtotime("now"); $timestamp = strtotime("now"); echo "Â Â "; $str = date('l dS of F Y h:i:s A', $timestamp); echo $str; ?> <p> <?php echo strtotime("next Thursday"), ""; $timestamp = strtotime("next Thursday"); echo "Â Â "; $str = date('l dS of F Y h:i:s A', $timestamp); echo $str;
View Replies !
Strtotime Problem
How do I find the number of seconds from a certain date to the current? I have logged in my database a completion date within the past year and I want to figure out how many seconds it has been since the completion date until now. I know the strtotime command is fairly versatile and I have tried the following without the right conclusion: PHP Code: strtotime("since ".$completion_date); //and strtotime("from ".$completion_date); What do I need to do to fix this?
View Replies !
Strtotime Busted
$thing = "2005-10-01"; $storedDate = date("z",strtotime($thing)); echo $storedDate; it just alwats returns today's date, ive tried it on a php5 server and it worked fine however on the server I need this one it is PHP4.2.
View Replies !
Converting Date To Minutes
I have $x="200504161035" that is 10:35 on 16 April 2005. My questuion: what is the *shortest* piece of code to convert that variable to minutes? I have a feeling there is a PHP function that should be able to do it but I cannot find it. The long way takes 5 lines of code.
View Replies !
Seconds To Minutes Conversion
I have a form where a user enters a value that will always be a number which represents minutes. I have the column that receives these values in the mysql table set to time format. the problem that I'm having is when I send the value form the form to the mysql table the number is treated as seconds. how do I change it so that the value is treated as minutes and not seconds.
View Replies !
Cookies Are 2 Minutes Off In IE (with Setcookie)
I'm testing pages using cookies set with setcookie. I suddenly started experiencing failures in IE. But Firefox was still fine. I noticed that it had to do with the cookie expiry time (I have v. 7). I had lowered the expiry threshold so I wouldn't have to keep clearing my browser cookies to test. Is there some kind of minimum expiry time for IE?? Like 2 minutes...? Does IE shave two minutes off the top? Here's what I found: time() + 3600 gives me 58 minutes in IE and 1 hour in Firefox time() + 60 gives nothing I have time to notice in IE and a minute in firefox time() + 120 gives me a couple seconds in IE and 2 min in firefox Is this an IE "feature" or is it me that's doing something wrong? I am new to this after all... example of how i set the cookies: $hour = time() + 120; setcookie(wpsite, $_POST['username'], $hour); does work for the most part, just that little issue so far. I don't care whether it's fixable or not, it's just that I though I was going crazy at first when I was trying to troubleshoot the problem; could not figure out what was going on initially.
View Replies !
Set A Session To Expire In 20 Minutes
Let's say you set a session to expire in 20 minutes. Does reading and/or writing a session value bump that time up each time, or does it expire 20 minutes from when it was first created? I am pretty sure it is the former, but I want to check to make sure.
View Replies !
Session To Expire After 30 Minutes
I have a guestbook where I want the users to be able to delete their own posts. This is a part of my code: PHP Code: session_cache_expire(30); session_start(); Â Â Â Â $_SESSION[('unique_id')] = session_id(); Â Â Â Â $sessionen = $_SESSION[('unique_id')]; PHP Code: // Here is decided if the user is able to delete the post if ($sessionen == $rad[sess_id]) { print ("<a href=gastbok.php?remove=$rad[id]><img src=../Ikoner/delete.gif alt=Delete this post width=27 height=14 border=0 align=middle onclick="return raderaInlagg()"></a>"); } The thing is that I want the session to expire after 30 minutes (if the user forgets to close down the browser), but I can't get it to work. What am I doing wrong?
View Replies !
Captcha Every X Ammount Of Minutes
On my social networking site I want to check how many messages and comments a user has sent in say a 10 minute time, if this number is greater then 10 I want to display a captcha, I have the captcha code from other areas of the site so would like to implement the same code. Would it be best to create a new table and everytime a message or comment is sent, update this table with a users ID number and the datetime of the action, then check this new table before posting a new message or comment, then daily like empty this table for size? Below is my mail and comment table the most important thing is performance, need the best performance .....
View Replies !
Limits Posts Per 10 Minutes
im working on a homemade forum for my site and im trying to make a way to stop a person from being able to post more than 10 posts in 4 minutes (or what ever is a good time frame). and if the user does this more than 3 times there account gets deleted can someone instruct me on how to do this.
View Replies !
Script Takes A Few Minutes To Run
I'm running a script that takes a few minutes to run. I set the max execution time in php.ini to 3600 seconds but the script still crashes after 8-17 minutes, saying "page cannot be found". I tried running it on 2 different machines more than once on each. What can I change to keep it from crashing?
View Replies !
Cronjob Execute Each Minutes
when I execute a php script using a cronjob in this way */5 * * * * /usr/bin/php /usr/local/script/myscript.php It works without problem and execute each minutes If I use */5 * * * * /usr/bin/php /usr/local/script/myscript.php > /dev/null
View Replies !
How Many Minutes Have Passed From A Given Time
i egt php to tell me in minutes how many minutes have passed from a given time for example i have a form that a user enters 2 times 1 when he took off and one where he landed i need php to work out how many minutes have elapsed from the take off time. currently i am useding the timespan command but i can get it to work out in minutes correctly i think. PHP Code: $timespan =($landingtime + $takeofftime);
View Replies !
Adding Minutes To A Timestamp
How can I add 15 minutes to the previous event time (timestamp) to get the next event time. Note: This event time is not in a table. Straight forward adding the two values will probly not provide the correct result. I can get the correct time with Mysql addtime($time, $duration) but that is only good if the if info is in a table. Code:
View Replies !
Timestamp - Display Minutes?
<?php $stamp = date("Y-m-d-h-m-s"); echo $stamp; ?> My code is not quite working - everything but the minutes is working...what's the correct thing to put in to display minutes?
View Replies !
Logout After Idle X Minutes
i'm working on a login system.. and I was wondering... how's the best way to make sure the user get's automaticly logged out after, let's say 5 minutest idle? i have a function called authUser() where I check cookies against the database... should I insert a code in there that sais somthing like this? Code:
View Replies !
Number Of Minutes Etc. Between Two Times
OK I have two timestamps. One is the value for the current time. The second is a time that a song was last played. <? $select = mysql_query("SELECT * FROM songs ORDER BY lastplayed DESC LIMIT 1"); // returns latest played song $songinfo = mysql_fetch_array($select); $todaysdate = date("YmdHis"); $songlastplay=$songinfo[lastplayed]; ?> Say for example the value of $songlastplay for this particular song was "20070213005812" and the current date were "20070213012056". How would one work out how many days, hours, minutes and seconds were between these two dates?
View Replies !
Strtotime - Setting From Present
I am having trouble setting the strtotime function to echo 'Y-m-d' on any day from 1 - 24 months past. I have attempted the following from links that call to different ranges of dates; 6 months, 9 months, 12 months, etc. -- from present time: My SQL is set up as follows: WHERE Date between 'pastDATE' and CURDATE() pastDATE = $HTTP_GET_VARS["getDATE"] <a href="oldies.php?getDATE=<? echo strtotime ("-6 months ago"); ?>"> 6 MONTHS OLD </a> How can I echo the strtotime as "Y-m-d"?
View Replies !
Strtotime() - Compare Two Dates
i dont get the format for it, say i have a date 06-06-2003, will it read that as month/day/year or day/month/year? what about mysql dates. 2003-06-06 how does it read those? i just want to compare two dates.
View Replies !
Strange Strtotime() Behavior
I'm trying to use the strtotime() function to manage sessions. But I get the following <?php print(time() . " - " . strtotime("+1 hour")); ?> outputs: 1097380666 - 1097308800 Strange strtotime("+1 hour") produced a time stamp less than the current time. It also never changes. In other words strtotime("+1 hour") always results in the time stamp 1097308800. I have also tried strtotime("+1 hour", time()) with the same result Is this correct, have I misunderstood the strtotime() function? I'm running Gentoo with kernal 2.6.8.1, php 5.0.1, apache2
View Replies !
Displaying A Date With Strtotime
I have successfully used strtotime to format the date on a webpage that is pulled form a MySQL database in the form yyyy-mm-dd. However, in another part of the webpage, I have to insert another date that may contain a NULL entry in the database. If I use strtotime to format this then it enters the current date, whereas I want it left blank.
View Replies !
Strtotime And A Very Mysterious Date
Namely the thirteenth of December 1901, 12:45:52, Pacific Time. All dates later than this passed in format "yyyy-mm-dd hh:mm:ss" to the strtotime function return the correct unix timestamp value (as can be verified by passing it back to date()). If a date earlier than 1901-12-13 12:45:52 is used, it returns an error. I tried this for a while to find the exact cut-off point, and this is it. Any reason - possibly a limitation of the integer value that is used? I didn't find this documented anywhere...
View Replies !
Strtotime - Use Abbreviations For Week
I'm pretty sure I used to be able to use abbreviations for week (w), days (d), etc in strtotime (e.g. strtotime("-3d") = 3 days ago), but now it doesn't work as expected unless I specifiy the whole word ("-3 days"). Has anyone else come across this ?
View Replies !
|