Delete File (timestamp & Date Problem)
I want to delete a file which is modified at least 60 minutes ago. i failed to do it.i fetched the last modified timestamp using filectime() or filemtime. but how can compare if it is last modified at 60 mins ago?
View Complete Forum Thread with Replies
Related Forum Messages:
Delete Old Timestamp
I want to delete all timstamp entried older than 2 days. This fails to delete do anything and there is no error. The field name is date and table name is logbook $sql="Delete from logbook where TIMESTAMPDIFF(DAY, 'date', NOW()) > 2 " ;
View Replies !
Order By Date When Date Not A Timestamp
I have a database of items with 2 fields, LogDate and LogTime. I would like to be able to display these items ordered newest to oldest. LogDate is a VarChar(11) and the format of the data is always DD-MMM-YYYY (30-AUG-2006) LogTime is a VarChar(7) and the format is always HH:MMAP (02:47pm) How can I order my SQL to sort by those 2 fields as if they were real dates?
View Replies !
Question About The "date / Time" Continuum - Timestamp Or Add Date As Varchar?
I have a new project that consists of work order tracking. It's nice cause I can use a lot of the same code from my last project which was delivery tracking. However when I tried to create a MySQL table using two timestamp fields, it stopped me. MySQL will only allow one timestamp. So I did some googling and now am thinking I can use the php date function to get the date format of my choice and post the results into a textfield then post to MySQL as a varchar. I'll still be able to sort date records the same in my queries and it's easier for me as a n00b to manipulate the data; Ditching the time and creating expressions / queries on timestamp fields gives me fits. Code:
View Replies !
Timestamp -> A Useful Date
hi, i want to display a formatted version of the next 7 days on a page. I can add so many seconds to a timestamp, but, how do i convert that timestamp into a useful formatted date?
View Replies !
Get Timestamp Of Date
I have a date object which I want to get the timestamp for. The date is 24/8/2007 18:30:00 I simply want to determine what the timestamp is for this date and time so that I can compare it against the current timestamp. The problem is that the timestamp is for the current time, not the date and time that I have specified. Here is my code: $mydate = date("d-m-Y : H:i:s", mktime(18, 30, 0, 8, 24, 2007)); $datestamp = time($mydate); echo 'My date: '.$mydate.' - Date stamp: '.$datestamp;
View Replies !
Date From Timestamp(14)
I used echo date('l, F d, Y', $row['timestamp']); to get date from timestamp(14) in db. It says 'Tuesday, January 19, 2038' lieu 'Saturday, June 18, 2005' Why?
View Replies !
Timestamp To Date In Php
I really can't make sense into this to see why it's not working. I've looked at other examples on the net but I still get a weird date. I'm retreiving my date from a column called date llogin which is a datetime column which I'm storing using Date("Y-m-d H:i:s") I have the following: <?=date("d-m-Y", strftime($a1[llogin]));?> But it's giving me this date. 31-12-1969.
View Replies !
UNIX Timestamp To Date
I looked in the forums little and in the php manual but I didn't find what I wanted. I want to know how I could change a unix timestamp into a normal date such as MMDDYYYY.
View Replies !
Date To Unix Timestamp
I am getting a date and time from a user. The send in a date with the format dd-mm-yyyy and a time with format hh:mm and then send in whether it is am or pm. now i split the date and time, then try to figure out the hour using: Code:
View Replies !
Getting Date (timestamp) As Time Value?
I'd like to read out a date from the a DB, but as time var. By default I seem to get it as a string. E.g. while(odbc_fetch_row($result)) { $tt= odbc_result($result,2); echo date("d.m.Y", $tt).", ".odbc_result($result,6) . " <br>";
View Replies !
Convert Date To Timestamp
Which one of the php functions will convert a date into a timestamp. I'm looking at the date/time functions on php.net, but they all seem to work the other way.
View Replies !
Mysql Date To Timestamp
I would like to use php to query a database and retrieve a unix timestamp. The problem is that mysql is storing the data in the date format and not a timestamp. I am sure that I can amend my query to format the date returned as a timestamp without having to do the conversion in php. Can someone tell me what to put in my db query?
View Replies !
Fetch The Date From Timestamp
i have a mysql table with 3 fields 1.id 2.time 3.approved values 1 1181237691 0 2 1181237703 0 3 1181237711 0 i want to fetch the distinct dates from this timestamp values using select statement. i want to display like this 1 2007-06-07 second thing i want to update the approved value=1 where these distinct dates are equal to the above timestamps.
View Replies !
Problem With Date() And Timestamp
I've used date() a million time before with a Unix timestamp pulled out of a MySQL database but this time it just isn't working as expected: <?php mysql_connect('localhost', 'x', 'x'); mysql_select_db('x'); $query = mysql_query('SELECT * FROM `pub_news` ORDER BY `date` DESC'); while ($row = mysql_fetch_array($query)) { echo date("nS F Y", $row[date])."<br>"; } ?> The two database values for the 'date' field are �' (5th May 2007) and �' (11th May 2007). The code outputs the correct values for the fields as $row[date], but date() displays both as 5th May 2007. I have checked the server time and although it's a few minutes fast, it seems OK. Am I being really stupid and missing something obvious?
View Replies !
Getting A Readable Date From Linux Timestamp
I have a form that exists from 3 separate dropdown-lists. The first list enables you to choose the year (YYYY) The second list enables you to choose the month (MM) And the third list allows you to choose the day (DD) To make a timestamp wich is easy to compare, I create a var. $date = "$year$month$day"; This var. combines the 3 values into 1 number (20030516) PHP puts this number into a mysql db as an integer(8). Now, while retrieving from the database, I would like to order by date, so 20030101 comes BEFORE 20030102. This is easy but I have a little problem: The date must be displayed in yyyy-mm-dd format after comparing it to today's date. So while retrieving, it is ordered by date and compared to today's YYYMMDD-timestamp. So: How can I make YYYYMMDD look like YYYY-MM-DD ? I prefer to do this with php.
View Replies !
SQL Date/time Or Unix Timestamp?
Generally when developing applications I use unix timestamps as the method of storing dates in a sql database. However, I was wondering if I should use the standard date-time used by the database. The question then arises: continue using PHP to manipulate the dates, or allow the sql server to take over. Can anyone provide any reasons to use sql date-time rather than unix timestamps?
View Replies !
Insert A Date Into A Timestamp In MySQL
I want to insert a date into a timestamp in MySQL as follows: $date = date('U'); $uid=$row['userid']; $updt = dbquery("UPDATE users SET last_login = '$date' WHERE userid = '$uid'"); This will not work for some reason. If I : $uid=$row['userid']; $updt = dbquery("UPDATE users SET last_login = NOW() WHERE userid = '$uid'"); I get a MySQL Datetime inserted.
View Replies !
Date Format / Timestamp Problem
I am facing one problem in php, mysql whenever i submit empty date to db, it automatically takes timestamp as 943900200 ('30-11-1999') which is creating problems in my application..... currently handling this problem by hard coding timestamp validation.
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 !
Display The Date From A Mysql Timestamp
i'm just trying to display the date from a mysql timestamp in php. using this line: date('l dS of F Y h:i:s A', $PostDate); but for some reason that line gives me this date: Monday 18th of January 2038 09:14:07 PM and the time stamp in mysql database is: 20050830100156 any idea what going on here?
View Replies !
Setting Automatic Date (timestamp) On Db From Form
I'm setting up a web-page that will allow a group to post information about books that they've received and when they've received them. I would like the "date received" part of the form used for inputting information about the books to be set automatically and invisibly. However, I would need to be able to show that date as mm/dd/yy on a list coming from the MySQL db. The fields of the table are ID, Title, Author, Publisher & Date Received. Of these, only Title, Author & Publisher would be input manually.
View Replies !
Output Format For A Timestamp Date Variable
I have a variable - $lastdate - that is the latest date any record in a MySQL database was updated. Its MySQL format is TIMESTAMP. If I say [echo $lastdate] I get the output I'd expect - 20060424221549 which is a YYYYMMDDHHMMSS format. I'd like to be able to display that using a format of mm/dd/yy with no leading spaces on the month and day. I don't know what the php command is to do this. In other words, I'm trying to display a variable - $lastdate - formatted a certain way. I know that the formatting string n/j/y will get my output looking as I'd like, but I can't figure out how to apply that to my variable.
View Replies !
Text Input Of Date And Timestamp Fields
I'm working on a PHP frontend for a PostgreSQL db and I'm looking for the best way to create date or timestamp inputs. Let's take a date in the format yyyy-mm-dd as an example. This is too error prone, I know my users will do it wrong <input type="text" name="fieldname"> Right now I'm thinking about something like this: <input type="text" size="4" name="y_fieldname">- <input type="text" size="2" name="m_fieldname">- <input type="text" size="2" name="d_fieldname"> but this is IMO a very ugly solution, because after the SUBMIT I have to glue all the parts together before inserting the values into the db. Something like this: <input type="text" format="yyyy-mm-dd" name="fieldname">
View Replies !
Effective Due Date? Timestamp? FATAL Error.
I'm building a library with php, and want to create a way for the return date for an item to automatically be 14 days after they are checked out. I had hoped to use something like: $Check_Out_Date=TIMESTAMP[(8)]; and then manipulate that with substrings and whatnot, until i could put it back together as 2 weeks later. Unfortunately I'm getting a FATAL error, with this.
View Replies !
Create A Date Field Of Type TIMESTAMP
I have a guestbook on my site. It uses a mysql database and holds names, email and a message. I'm trying to modify it so that it will also hold the date/time that reecord was submitted. So I want and created a date field of type TIMESTAMP to hold these values, and adjusted my php script to add another field. Now, when the guestbook is filled out, in my new field, all I get is a bunch of 0s. Why is this?
View Replies !
Unix Timestamp Into Textual Date Time
How do i convert a Unix timestamp into English textual date time description? In my database i have stored the date and time as 1187079740 and now i want it to be converted into 14/08/2007 13:52:20. I have currently used <?php $format = '%d/%m/%Y %H:%M:%S' $strf = strftime($format); echo "$strf "; print_r(strptime($strf, $format)); ?> I am generating data from a db to xml which gives date as <date>1187079740</date> Now my task is to convert SPECIFICALLY the value 1187079740 into it's actual textual form of 14/08/2007 13:52:20. I want the data 1187079740 to be written into a php script to generate it's textual time.
View Replies !
Delimiting Timestamp Queries To Show Only Date, No Time
I can't find anything on google or even searching the forums that comes remotely close to being understandable by me. I have a MySQL timestamp(current timestamp) I'm using to date every entry. HOWEVER, I can't figure out how to get rid of the time portion and only display the date.
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 !
Convert User Entered Date And Time To Unix Timestamp Before Inserting To Database
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and three dropdow boxes for hours, minutes, and AM/PM. All of these need to be considered together and converted to one Unix Timestamp and then inserted to the MYSQL date field. The type of field is INT (11) so that I can instead of the standard 0000-00-00 format of MYSQL so that I can do better calculations and queries.
View Replies !
Delete MySql Row By Date
Can someone help me with the following problem: I have a table that includes a column for "last application date", let's simply call it "date". Now the problem is how to automatically delete rows where the information in the "date" column has gone old, let's say by -86400 (1 day). Example: today's date is April 11th, which means that all rows with the info April 10th in the date column would get deleted.
View Replies !
Auto Delete Date Based Calendar Events
Out of both wanting to improve my PHP skills and necessity, I created my own small CMS for a non-profit site I am involved with. One of the features I have is an event calendar where other users can submit events, which then go into a "holding tank" until I can approve or deleted them. It's working great and everyone is loving it... but I have discovered one issue. When the date of the event passes, I have to log into the admin area and manually remove it. I am actually not deleting it from the database but changing a field variable and archiving it for our records. I have been trying the past few days to come up with the necessary PHP to automatically check the current date (today's date) against all the calendar events and remove ones that have already happened. I could then hook this up to a CHRON action in my hosting CPanel and call it a day - at least that is how it all plays out in my head. I imagine in order to point me in the right direction you will need some information about my database.
View Replies !
Reading A Log File One Line At A Time Depending On Timestamp
Currently I am attepting to create a stats package for my companies website (yes my life would be 100% stress free if I was allowed to use a standard/commercial stats package ). So far things are all good, and ive progressed quite far. But ive hit a snag. At the moment im reading in the WHOLE log file and sorting it into an array and passing the neccesary data to mysql. Easy peasy. But my boss has pointed out to me that as the site gets more and more traffic the log gets bigger, and if it gets to big the servers memory will overload, and we all know what happens then! So what I need to do is read in the file one line at a time. and compare the timestamp to the last time the script was run. If the timestamp in the log is less than the last timestamp for when the file was run dont read it. If it is more than defiently read it. Code:
View Replies !
What Is The Best Way To Delete File ...?
I have script that allows a user to upload a txt file for processing, filtering, to save bandwidth,instead of user reuploading the file everytime he/she does a new process on the same file, i save the file to the server, and process from that file. What I want to be able to do is, when the user uploads a new file, or leaves the site, this temp file is automatically deleted (saves disk space).
View Replies !
Delete File();
I was wondering if php4 has a built in function that could delete a file. In my case I need my php to delete a picture. (jpg, gif) Does php4 have the ability to delete an exsiting file? Something like this?? delete_image("../images/somePic.jpg");
View Replies !
File Delete
I need to delete a compressed backup file after it has been sucessfully uploaded to a ftp server, the upload works fine using CRON and a php page. I have tried to delete the file using: <? $oldfile = "/home/#*$!/backup-10.8.2005_07-00-01_yyy.tar.gz"; unlink($oldfile); ?> However I get a permission denied, what's wrong? Also, I don't know the exact file name, so what I really want to do is wildcard the file name like this: <? $oldfile = "/home/xxx/backup-*_yyy.tar.gz"; unlink($oldfile); ?> Is this possible?
View Replies !
Converting An SQL TIMESTAMP Into Unix Timestamp
I look over the docs on MySQL, and I'm assuming MS SQL will be quite similar. I am trying to decide how best to pull this off. I am anticipating a need to take the typical SQL TIMESTAMP and convert it to an Unix Timestamp... Now, as I look at this a TIMESTAMP stores namely a "numerical" format in a 14 Digit String. I'm just wondering if anyone has a suggestion as to how I might split this into the componenets (4d Year/3d Month/2d Day/HH MM SS) so that it could be passed through mktime() (which will give me the unix version). Actually, I think I may have an approach.. perhaps using the php substr() function.. since it returns a "defined" portion of a string.. if $x was our timestamp, we'd have to pass it through the substr() function a few times, to pull out the pieces we wanted.
View Replies !
|