Re: [PHP] mysql date question

2008-01-03 Thread Richard Lynch
On Thu, January 3, 2008 8:30 am, Adam Williams wrote: > I have a field in mysql as shown by describe contract; > > | length_start | date| YES | | NULL > || > > Which stores it in the mysql format of -MM-DD. However, I need > the > output of my selec

Re: [PHP] mysql date question

2008-01-03 Thread Silvio Porcellana
Uhm, a shot in the dark - try: select date_format(contract.length_start, '%m-%d-%Y') as length_start HTH, cheers! Silvio Adam Williams wrote: I have a field in mysql as shown by describe contract; | length_start | date| YES | | NULL || Which s

RE: [PHP] mysql date question

2008-01-03 Thread Bastien Koert
no need for quotes select date_format(contract.length_start, '%m-%d-%Y') as length_start from contract where user_id = 1; bastien > Date: Thu, 3 Jan 2008 08:30:55 -0600> From: [EMAIL PROTECTED]> To: > php-general@lists.php.net> Subject: [PHP] mysql date questio

RE: [PHP] mysql date question

2008-01-03 Thread Jay Blanchard
[snip] I have a field in mysql as shown by describe contract; | length_start | date| YES | | NULL || Which stores it in the mysql format of -MM-DD. However, I need the output of my select statement to show it in MM-DD- format. I can sel

Re: [PHP] mysql date question

2008-01-03 Thread Stut
Adam Williams wrote: select date_format('contract.length_start', '%m-%d-%Y') as length_start from contract where user_id = 1; This has nothing to do with PHP, but the first parameter to date_format should not be in quotes. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.p

[PHP] mysql date question

2008-01-03 Thread Adam Williams
I have a field in mysql as shown by describe contract; | length_start | date| YES | | NULL || Which stores it in the mysql format of -MM-DD. However, I need the output of my select statement to show it in MM-DD- format. I can select i

Re: [PHP] Confused overSimple PHP mySQL date question

2004-09-14 Thread John Holmes
From: "Scott Miller" <[EMAIL PROTECTED]> I have a mysql database that has a date field and a time field. I want users to be able to enter a date and a time in text boxes on an html form and have them end up in the database. Code examples would be good here. Either way, the format for a DATE field

RE: [PHP] Confused overSimple PHP mySQL date question

2004-09-14 Thread Jay Blanchard
[snip] DATE field in a mysql database. What obvuios thing did I miss? Note I am not using the system date or time stamp, these are entered dates. [/snip] You're using a DATE field in the MySQL database. MySQL requires an ISO formatted date unless you manipulate it, such as 2004-09-14 http://dev.

[PHP] Confused overSimple PHP mySQL date question

2004-09-14 Thread Scott Miller
Hi, I have checked the recent list archives and looked up various PHP functions. I know what I want should be simple but, apparently not simple enought for me. I have a mysql database that has a date field and a time field. I want users to be able to enter a date and a time in text boxes on an

RE: [PHP] PHP & MySQL DATE comparison

2004-06-16 Thread Ryan Schefke
ution. -Original Message- From: Ryan Schefke [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:43 PM To: Php-General-Help Subject: [PHP] PHP & MySQL DATE comparison Hello, I'm pulling a date in the "datetime" format via a MySQL query. Using PHP I would like to che

[PHP] Re: PHP & MySQL DATE comparison

2004-06-16 Thread Torsten Roehr
"Ryan Schefke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > > > I'm pulling a date in the "datetime" format via a MySQL query. Using PHP I > would like to check if that date is prior to today's date. Can someone > please help with this quick question. You could conver

[PHP] PHP & MySQL DATE comparison

2004-06-16 Thread Ryan Schefke
Hello, I'm pulling a date in the "datetime" format via a MySQL query. Using PHP I would like to check if that date is prior to today's date. Can someone please help with this quick question. Thanks, Ryan

RE: [PHP] MySQL Date

2003-03-19 Thread John W. Holmes
> I have a date stored in a table in my MySQL Database using a DATE type for > the column. > > How can i compare the date in the table to today ... WHERE your_date = CURDATE() ... > e.g. > > $today = mysql_result($result, $i, Booking_Date); > > if($today = *HELP*){ or... if($today == date('Y

RE: [PHP] MySQL Date

2003-03-19 Thread Barajas, Arturo
(427) 271-9918, x448 > -Original Message- > From: shaun [mailto:[EMAIL PROTECTED] > Sent: Miercoles, 19 de Marzo de 2003 07:19 a.m. > To: [EMAIL PROTECTED] > Subject: [PHP] MySQL Date > > > Hi, > > I have a date stored in a table in my MySQL Database using a &g

[PHP] MySQL Date

2003-03-19 Thread shaun
Hi, I have a date stored in a table in my MySQL Database using a DATE type for the column. How can i compare the date in the table to today e.g. $today = mysql_result($result, $i, Booking_Date); if($today = *HELP*){ echo "you are booked today"; }else{ echo "you are free today"; } than

[PHP] Mysql Date got prob!

2003-02-28 Thread Dhaval Desai
Hello, As related to my earlier question select date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y- %m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN '2003-02-01' AND '2003-02-10') The above query is valid but returns 0 because 'dept_date1' is treated as a string. I want

[PHP] Mysql Date problem...weird..

2003-02-28 Thread Dhaval Desai
Hello, Please read the below query and the information that I have mentioned. This is really weird... select date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y- %m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN '2003-02-01' AND '2003-02-10') When it goes to databa

RE: [PHP] Mysql date format

2002-11-07 Thread John W. Holmes
> I'm using php with MySql. > I'm migrating an php-oracle application to php-mysql. I need to know if > exists any function in mysql similar to the "to_char" or "to_date" > functions > of oracle; or "format" function of access?. These functions make a date > format or numeric format. > > ex: to_c

[PHP] Mysql date format

2002-11-07 Thread R B
I'm using php with MySql. I'm migrating an php-oracle application to php-mysql. I need to know if exists any function in mysql similar to the "to_char" or "to_date" functions of oracle; or "format" function of access?. These functions make a date format or numeric format. ex: to_char(sysdate,'

Re: [PHP] PHP/MySQL -- Date/Time Confusion

2002-07-12 Thread Anas Mughal
The easiest and my preferred way is to use "strtotim" method. This method accepts MySQL format "2002-12-23" and converts it into a UNIX time stamp. After that you can use the date function to format time as you wish! Monty <[EMAIL PROTECTED]> wrote: Which method is the best way to store date/

RE: [PHP] PHP/MySQL -- Date/Time Confusion

2002-07-12 Thread David Freeman
> Which method is the best way to store date/time in MySQL and > then which PHP > command is the best to use to convert that date to something > useful? Get comfortable with MySQL's date functionality and you'll find that you don't often need to do the date comparisons and manipulation in

Re: [PHP] PHP/MySQL -- Date/Time Confusion

2002-07-12 Thread 1LT John W. Holmes
EMAIL PROTECTED]> Sent: Friday, July 12, 2002 5:06 PM Subject: [PHP] PHP/MySQL -- Date/Time Confusion > Which method is the best way to store date/time in MySQL and then which PHP > command is the best to use to convert that date to something useful? I'm > having a difficult time

[PHP] PHP/MySQL -- Date/Time Confusion

2002-07-12 Thread Monty
Which method is the best way to store date/time in MySQL and then which PHP command is the best to use to convert that date to something useful? I'm having a difficult time figuring out how to reconcile the date in MySQL so it works with PHP's various date commands, like getdate(). Any suggestion

[PHP] MySQL date and NULL problems

2001-12-14 Thread sgibbs
Hi again, A few days ago, I sent in an inquiry (see below) about how to make the date field in mysql read NULL when the corresponding form field was empty. I tried the suggestions I received and the following if statements all seem to still result in a default -00-00 instead of NULL. / thi

Re: [PHP] mySQL date converting

2001-08-07 Thread Bjorn Van Simaeys
Hi, You could write a PHP script to get all the current values (I presume that you've put varchar as datatype), parse them with string functions and convert it in the way you'd like them to be. All this is not so difficult to make. I prefer to store my date/times in the UNIX timestamp form. I u