Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 02:45 pm, Stuart Felenstein wrote:

 Apparently, mysql does not like the format
 MM/DD/
 Then again I tried it around , still no dice.
 It's intended to go into a Date column.

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

All, you every need to know if right there..

Jeff


pgpS5L2p8iK4l.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread Stuart Felenstein
Thanks , I know the page and have the links
bookmarked!

Stuart

--- Jeff Smelser [EMAIL PROTECTED] wrote:

 On Thursday 14 October 2004 02:45 pm, Stuart
 Felenstein wrote:
 
  Apparently, mysql does not like the format
  MM/DD/
  Then again I tried it around , still no dice.
  It's intended to go into a Date column.
 

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
 
 All, you every need to know if right there..
 
 Jeff
 

 ATTACHMENT part 2 application/pgp-signature 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:12 pm, Stuart Felenstein wrote:
 Thanks , I know the page and have the links
 bookmarked!

So you got the answer from it right?

Jeff


pgpSsmcBOJscM.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread Stuart Felenstein
No :),. cause it seems that those formats are for
outbound, db -.
I was looking for the other direction.

Stuart
--- Jeff Smelser [EMAIL PROTECTED] wrote:

 On Thursday 14 October 2004 03:12 pm, Stuart
 Felenstein wrote:
  Thanks , I know the page and have the links
  bookmarked!
 
 So you got the answer from it right?
 
 Jeff
 

 ATTACHMENT part 2 application/pgp-signature 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:35 pm, Stuart Felenstein wrote:
 No :),. cause it seems that those formats are for
 outbound, db -.
 I was looking for the other direction.

Huh? It really doesnt matter does it? They work either way..

I use those functions all the time for inbound..

Jeff


pgpssSczCg1j2.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread SGreen
For values headed into a SQL statement, use whatever functions are 
available to you in the language (PHP, PERL, Python, Java, VB Script,...) 
you are using to accept the user's input in order to make the commands you 
send MySQL correct.  You just need to convert the date into -MM-DD 
hh:nn:ss format and MySQL will be as happy as a clam.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Stuart Felenstein [EMAIL PROTECTED] wrote on 10/14/2004 04:35:21 PM:

 No :),. cause it seems that those formats are for
 outbound, db -.
 I was looking for the other direction.
 
 Stuart
 --- Jeff Smelser [EMAIL PROTECTED] wrote:
 
  On Thursday 14 October 2004 03:12 pm, Stuart
  Felenstein wrote:
   Thanks , I know the page and have the links
   bookmarked!
  
  So you got the answer from it right?
  
  Jeff
  
 
  ATTACHMENT part 2 application/pgp-signature 
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:46 pm, [EMAIL PROTECTED] wrote:
 For values headed into a SQL statement, use whatever functions are
 available to you in the language (PHP, PERL, Python, Java, VB Script,...)
 you are using to accept the user's input in order to make the commands you
 send MySQL correct.  You just need to convert the date into -MM-DD
 hh:nn:ss format and MySQL will be as happy as a clam.

That, or str_to_date will work nicely for what he is looking for.. Which was 
my point.. 

Jeff


pgpXlFpQANUPu.pgp
Description: PGP signature


RE: Converting date in MySQL

2004-10-14 Thread Mike Johnson
From: Jeff Smelser [mailto:[EMAIL PROTECTED] 

 On Thursday 14 October 2004 03:35 pm, Stuart Felenstein wrote:
  No :),. cause it seems that those formats are for
  outbound, db -.
  I was looking for the other direction.
 
 Huh? It really doesnt matter does it? They work either way..
 
 I use those functions all the time for inbound..

It does matter, though. You can't use DATE_FORMAT() to translate
'10/14/2004' into '2004-10-14.'

It looks like what the poster wants is STR_TO_DATE() (a la
STR_TO_DATE('10/14/2004', '%m/%d/%Y'), but that's not available until
MySQL 4.1.1.

Out of curiosity, how /would/ you do this? I'm assuming you're not using
STR_TO_DATE() (as I didn't even know it existed until I just checked),
though I may be incorrect.

As the last poster said, if you're not using 4.1.1, you're better off
setting the format in the calling script. You'd assumedly need to do
some error-checking, anyway.


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smarterliving.com
[EMAIL PROTECTED]   (617) 886-5539


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 04:00 pm, Mike Johnson wrote:
 It does matter, though. You can't use DATE_FORMAT() to translate
 '10/14/2004' into '2004-10-14.'

No, your right, that would be wrong.

 It looks like what the poster wants is STR_TO_DATE() (a la
 STR_TO_DATE('10/14/2004', '%m/%d/%Y'), but that's not available until
 MySQL 4.1.1.

Yeah.. 

 Out of curiosity, how /would/ you do this? I'm assuming you're not using
 STR_TO_DATE() (as I didn't even know it existed until I just checked),
 though I may be incorrect.

I did.. And its there.. but he didn't say that wasnt an option, just that he 
didn't see anything think for inbound.. I was saying there was.. If he doesnt 
have the version, its left to the client.. which he didn't specify.

My answers can only be as good as the questions.. He left a lot open..

Jeff


pgpowCDfiCISX.pgp
Description: PGP signature