Web Analytics Made Easy -
StatCounter Time & Date question - CodingForum

Announcement

Collapse
No announcement yet.

Time & Date question

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

  • Time & Date question

    Hello,
    I'm trying to do some simple date stuff,

    i'm pulling dates and times from my data base,
    currently the date comes out like this:

    2005-08-02 11:32:18

    what i want to do is just grab certain peices of this data.

    example, in ASP could just do:
    day(Date()) to only get the day,
    or
    year(rs.date) to only get the year.

    can this same thing be done in PHP? and if so, how?

    thanks in advance for your time!
    -Ken

  • #2
    If you're using mysql:
    mysql date functions
    php date
    -Brando
    Why using tables for eating is stupid!

    Comment


    • #3
      hmm,, ok.
      i see how that works with the current date,
      but what about when pulling the date from mysql,
      does this really need to be in the select statement?

      or is there a way to just use something like this,

      from the example:
      // Prints something like: Wednesday 15th of January 2003 05:51:38 AM
      echo date("l dS of F Y h:i:s A");

      but with the date pulled from mysql.

      where does my value $DateAdded fit into this?

      thanks again for your time!
      -Ken

      Comment


      • #4
        Code:
        echo date("l dS of F Y h:i:s A", strtotime($dateadded));
        Whats the point of a signature?

        Comment


        • #5
          And if you looked at the mysql functions you would have seen date_format(), but either way.
          -Brando
          Why using tables for eating is stupid!

          Comment


          • #6
            kool,

            thanks guys!

            -Ken

            Comment

            Working...
            X