List:General Discussion« Previous MessageNext Message »
From:David Griffiths Date:February 20 2004 7:45pm
Subject:Re: Date_Format
View as plain text  
If you need the date like, '2004/01/01', then shouldn't it be '%Y/%m/%d'?

You still ahve the dashes (the '-' character) in your date-format, and you
need a forward-slash (the '/' character) instead.

Here's what I ran on MySQL:

mysql> select date_format(NOW(), '%Y/%m/%d');
| date_format(NOW(), '%Y/%m/%d') |
| 2004/02/20                     |
1 row in set (0.00 sec)

----- Original Message -----
From: "Jacque Scott" <jscott@stripped>
To: <mysql@stripped>
Sent: Friday, February 20, 2004 10:31 AM
Subject: Date_Format

> I have the following query where the user will put in a date.  They will
> put it in like '01/01/04'.  I use this date in my WHERE clause but MySQL
> needs the date like '2004/01/01'.  I tried using Date_Format('04/01/01',
> '%Y-%m-%d') to change the way it is formatted but I don't get the
> correct data back.  Can someone help with this?
> SELECT DISTINCTROW Products.NSIPartNumber, Sum(tblInvTransaction.Qty)
> AS SumOfQty
> FROM tblInvTransaction INNER JOIN Products ON
> tblInvTransaction.ProductID = Products.ProductId
> WHERE tblInvTransaction.Date <= Date_Format('01/01/04', '%Y-%m-%d')
> GROUP BY Products.NSIPartNumber
> HAVING Sum(tblInvTransaction.Qty)>0;
Date_FormatJacque Scott20 Feb
  • Re: Date_FormatDavid Griffiths20 Feb