Re: [PHP-DB] Date question
This works perfect, Bastien! Many thanks. Gerry On 3/13/06, Bastien Koert [EMAIL PROTECTED] wrote: select * from table where date_format(date_field, '%Y-%m') = '2006-02' bastien From: Gerry Danen [EMAIL PROTECTED] To: php-db@lists.php.net CC: [EMAIL PROTECTED] Subject: [PHP-DB] Date question Date: Sun, 12 Mar 2006 20:44:13 -0700 While I am rebuilding my crashed laptop (the machine that had all my intelligence), I started thinking about a select statement I need. I have log info in a table and want to extract it on a monthly basis. The date field is in -mm-dd format. What's a good way to select those dates that match 2006-02, for example. I apologize if the solution should be staring me in the face, but all my favorites and help files are toast, until I can restore some of them.
RE: [PHP-DB] Date question
select * from table where date_format(date_field, '%Y-%m') = '2006-02' bastien From: Gerry Danen [EMAIL PROTECTED] To: php-db@lists.php.net CC: [EMAIL PROTECTED] Subject: [PHP-DB] Date question Date: Sun, 12 Mar 2006 20:44:13 -0700 While I am rebuilding my crashed laptop (the machine that had all my intelligence), I started thinking about a select statement I need. I have log info in a table and want to extract it on a monthly basis. The date field is in -mm-dd format. What's a good way to select those dates that match 2006-02, for example. I apologize if the solution should be staring me in the face, but all my favorites and help files are toast, until I can restore some of them. TIA. Gerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date question
While I am rebuilding my crashed laptop (the machine that had all my intelligence), I started thinking about a select statement I need. I have log info in a table and want to extract it on a monthly basis. The date field is in -mm-dd format. What's a good way to select those dates that match 2006-02, for example. I apologize if the solution should be staring me in the face, but all my favorites and help files are toast, until I can restore some of them. TIA. Gerry
Re: [PHP-DB] Date question
For example, you have table `logs` with `datelog` field and you want to select dates that match 2006-02. You can try this select statement: SELECT * FROM `logs` WHERE MONTH(datelog)='02' and YEAR(datelog)='2006' Hope that helps. LJ Regalado
Re: [PHP-DB] Date question
Gerry Danen wrote: While I am rebuilding my crashed laptop (the machine that had all my intelligence), I started thinking about a select statement I need. I have log info in a table and want to extract it on a monthly basis. The date field is in -mm-dd format. What's a good way to select those dates that match 2006-02, for example. I apologize if the solution should be staring me in the face, but all my favorites and help files are toast, until I can restore some of them. Which database are you using? Mysql has this: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Postgresql has: http://www.postgresql.org/docs/8.1/static/functions-datetime.html I'm sure others have the same sort of functionality. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Question
I am having trouble converting a date from mm/dd/ to -mm-dd on a user form. I know there was post about this, but I keep getting an error message when I try to search the archives. I have looked at the manual, but I am not finding what I am looking for. Mark A. Bomgardner Technology Specialist KLETC
RE: [PHP-DB] Date Question
How are you trying to convert the date? bastien From: Bomgardner, Mark A [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Question Date: Wed, 27 Oct 2004 11:17:16 -0500 I am having trouble converting a date from mm/dd/ to -mm-dd on a user form. I know there was post about this, but I keep getting an error message when I try to search the archives. I have looked at the manual, but I am not finding what I am looking for. Mark A. Bomgardner Technology Specialist KLETC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Question
Bomgardner, Mark A wrote: I am having trouble converting a date from mm/dd/ to -mm-dd on a user form. I know there was post about this, but I keep getting an error message when I try to search the archives. I have looked at the manual, but I am not finding what I am looking for. echo date('Y-m-d',strtotime('09/24/2004')); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Question
Hi there everyone, I have the following 2 dates (FOr example): 19-02-2003 21-02-2003 How can I easily find out how many nights there are between the 2 dates? For example, the above would be 2 nights as the 21st would be the checkout date. I have the use the format about as that is how the info is given to me for me to parse via PHP. Thanks Chris
[PHP-DB] Date Question
Hi there everyone, I've never really used the date functions beyond getting it to store the current date in a db. I have a dilema in that I need to get all the days in the current month and all the days in the next month (whatever the next month is depends on the current month the script was ran)). How would I do this? I need to get to grips with the date function pretty quickly and it's kind of confusing (Using Linux for the OS, but programmed on Windows XP if that makes a difference to date handling). Any help would be very appreciated. As always thanks for any help you can give me. Regards Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Question
It would seem that on the page that you post your form to, you'll need to have a $date = date( m.d.Y ); to generate the actual date value.. That is if I understand correctly the date() function and the question. Later, Bob Weaver - Original Message - From: Jennifer Downey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 03, 2002 5:26 PM Subject: [PHP-DB] Date Question Hi all, If I have a feild called 'date' and the type is date when a form is submitted isn't it suppose to automatically enter the date or do I need to somehow enter it through the form? The reason I ask is that I have another form with a date type and no reference to it in the form and it is always entered. With this new form the date is not entered into the db. Any ideas why? TIA Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php