Results 1 to 2 of 2

Thread: date time help

  1. #1

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106

    date time help

    Hey. I have a php date time question. I am passing a date/time string to another page. The problem is that it is in the form:
    m/d/y h:m

    I want an easy way to parse out the year... month.. minutes.
    I thought that if I use that strtodate() I could do this.

    $time = "7/14/1981 3:45 PM"; // actually gets requested[].
    $timestamp = strtodate($time);
    $hour = date("h", $timestamp);

    That was just an example I wrote on the fly... but an error tells me that it is prior to 1970 and it can't do it. Is there another way that I can do this easily? Is there a problem with my logic... maybe I'm missing something.

    thanx,
    Brandon
    Master of Cyber Fu - A Temple of Digital Chi

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I've never heard of the strtoday() function, nor can I find any documentation on it. In fact, PHP gives me a function not defined error.

    If you use the strtotime() function, it'll work perfectly:

    Code:
    $time = "7/14/1981 3:45 PM"; // actually gets requested[].
    $timestamp = strtotime($time);
    $hour = date("h", $timestamp);
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width