Web Analytics Made Easy -
StatCounter mySQL date_format howto? - CodingForum

Announcement

Collapse
No announcement yet.

mySQL date_format howto?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mySQL date_format howto?

    I have the following piece of code to format the date from my Query.
    PHP Code:
    SELECT date_format(my_date'%Y%c/%d') AS the_date 
    but the %c is for the monthy removes the 0 (zero) on months 01-09. is there a format that will retain the zero or do i need to figure a way to get that zero back in the variable.

    The Reason is because I need to compair $the_date with $new_date = date ('Y/m/d')
    the select date_format results is 2006/9/20 and the date function results is 2006/09/20
    and the are not the same.

    Thanks
    -C
    Last edited by Cale; Sep 26, 2006, 09:11 PM.

  • #2
    Yep, use %m

    Ref:
    http://dev.mysql.com/doc/refman/5.0/...functions.html

    Good luck;
    -Brando
    Why using tables for eating is stupid!

    Comment


    • #3
      Brandoe85 to my rescue again, Thanks!! Not sure how I missed the %m but that worked perfectly.
      Thanks.

      Comment

      Working...
      X