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 Complete Forum Thread with Replies
Related Forum Messages:
Converting Timestamp Into Minutes And Seconds
I am timing employees who take a test. I have the start time and end time, which are unix epochs, and subtracing the start from the end will give me a large number of seconds, for example 552. I want to convert this into minutes and seconds.
View Replies !
Converting Time To 'days, Hours:minutes'
I'm trying to 'age' files but can't seem to figure it out. I'm getting the files modified value and doing: > time() - $mtime; to get back something like: > 18699668 How do I convert this value to 'xdays, yhours:zminutes'?
View Replies !
Converting Database Date To Normal Date
I am looking for a way to convert a date that is stored in a MySQL database like this after useing the date() function in PHP: 2006-08-16 21:03:54 and convert it into a date this: 16 August 2006 @ 11:03:54pm Does anyone have some insight as to how I would go about doing that?
View Replies !
Date Converting
I am retrieving a date from mysql (using the mysql date format YYYY-MM-DD format). Is there an easy way to convert a date in that format: YYYY-MM-DD to this format: MM-DD-YYYY
View Replies !
Converting To Date
I collect some data from a user registration form in the format: Day: 1-31 Month: 1-12 Year- 1990-2007 how i can convert this into proper date format so i can store it in my database :P?
View Replies !
Converting A Variable To Date
I searched around for a bit and tried reading the documentation on the date function, but I think I'm missing something, and figured someone could probably answer this pretty quickly. I'm coding a schedule creator for my school's television station. It's pretty basic (lots of forms and messy sql insertions). Code:
View Replies !
Converting A Date To Unix Timestamp
I have a form where people enter their birthday_day, birthday_month, and birthday_year Is there a way to do the following; convert_this_to_unix_timestamp($_POST['birthday_day'], $_POST['birthday_month'], $_POST['birthday_year']); The point is that if i store it as a unix_timestamp, then i can do some math on it and return the users age instead of their birthday.
View Replies !
Problem With Converting A Date In MySQL
I am having a problem with converting a date in MySQL. MySQL stores it as 2004-06-30 and I want to display it as 30 Jun 2004. How can I convert the MySQL string into the output I like? To further complicate this, I also would like to add 6 months to the outputted date! Is this easy or impossible?
View Replies !
Converting Dates To Mysql Date Field
Is there a way to convert a date in this format: 8-7-2002 to fit into a MySQL date field format 2002-08-07. the 8-7-2002 is a field in which users pick a date from a pop-up calendar in javascript. When I enter that date into the database, i want to convert it to the MySQL date format.....is there a way to convert it?
View Replies !
Importing .csv Converting Date Back To 0000-00-00
I have imported a .csv file back in to MySql all the data has imported correctly. I never realised what a time saver working with .csv can be, as I always used to do find & replaces through notepad. The only problem I am having is that the dates have defaulted to 0000-00-00
View Replies !
Converting Time Stamp To 'normal' Date Function
I'm looking for a bit of code/formulae to convert unix time stamp info into a conventional date format. I have a file that generates invoices from data requested from an sql table - trouble is it brings in the date as a timestamp. I'm looking for something I can plug into the php invoice file rather than altering the database.
View Replies !
Regex Issue - Converting A Written Date To A Timestamp
I have a problem, somehow through one of my scripts, all the timestamps in my database were set to 0000-00-00 00:00:00. I can fix this because one of the fields contains the written date in this format "Wednesday, June 7, 2006", I think I need to make a regex expression that can read that and generate a new timestamp from it, I'm just not sure where to start because I've barely used regex. Some of the dates are not in that format because it contains over two years worth of data, and I want to just delete the ones that are not in that format as well. I'd appreciate any help here, I'm kind of stumped. Once I match the expression I can generate the timestamp, but I don't know how to match it.
View Replies !
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 !
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 !
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 !
Script Termination And Reload After 5 Minutes
Strange problem on a lamp installation: A script runs longer than 5 minutes and sends no output to the browser until it is finished. When called at customer site it gets stopped after exactly 5 minutes and is reloaded automatically 4 times, then it gives up. This is logged in Apache access log. I have no clue what causes the reload after 5 minutes of "no data received". Could be the browser, could be the proxy. I even do not have a problem with the behaviour, you could avoid that by sending something to the browser periodically. BUT: The script gets stopped completely after the 5 minute period. That is what I dont like... No PHP log entry, no apache log entry about that. Just like killed. "ignore_user_abort" is enabled in PHP configuration. Any ideas what causes the script termination and how that can be avoided? Configuration details:
View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes? My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12 I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.
View Replies !
|