Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    date and time+ mysql

    Hello all

    I use a script which in some parts generates date , exactly with such format :

    Aug-4-2007 09:05:23 PM

    I searched inside the script to find any php date format like ('D M d, Y g:i a')
    which generates Aug-4-2007 09:05:23 PM but I didnt find ,

    something that I found is now(); from mysql,
    1-How can I change this format?
    2-I omite the time from date ?

    Thanks all (im not a php coder )

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    there are mysql functions out there to format a date, what does now() return?

  • #3
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rafiki View Post
    there are mysql functions out there to format a date, what does now() return?
    it returns date and time
    Aug-4-2007 09:05:23 PM
    I need the date in different format also the time,

    I changes all now() to CURDATE() but the returns didnt change

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    The php code below is = to August 4, 2007. Check the php manual - or a book - for more date and time functions.
    PHP Code:
    date('F j, Y'); 
    To format dates with DATE_FORMAT() from a MySQL database the input has to be YYYY-MM-DD HH:MM:SS
    Leonard Whistler

  • #5
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    The php code below is = to August 4, 2007. Check the php manual - or a book - for more date and time functions.
    PHP Code:
    date('F j, Y'); 
    To format dates with DATE_FORMAT() from a MySQL database the input has to be YYYY-MM-DD HH:MM:SS
    There is no date format in all script, only now() function

  • #6
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    so change now so that you use DATE_FORMAT along with NOW(). by the way NOW will not output the date in the way you have shown it will only output yyyy-mm-dd hh:mm:ss and no other format unless you use date_format

    show us your acutal code in that part of the script rather than us guessing.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •