[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

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

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 question I have a field in mysql

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

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

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 select

[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

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

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 is

[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

[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 convert it to a

RE: [PHP] PHP MySQL DATE comparison

2004-06-16 Thread Ryan Schefke
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 check if that date is prior to today's date. Can someone please help with this quick question. Thanks, Ryan -- PHP

[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; } thanks

RE: [PHP] MySQL Date

2003-03-19 Thread Barajas, Arturo
-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 DATE type for the column. How can i compare the date

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-m-d'))

[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

[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

[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:

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:

[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

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

2002-07-12 Thread 1LT John W. Holmes
: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 figuring out how to reconcile the date in MySQL so it works

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 php

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/time

[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. /

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