|
-
Jul 9th, 2004, 06:20 PM
#1
Thread Starter
Lively Member
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
-
Jul 10th, 2004, 07:51 AM
#2
Stuck in the 80s
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);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|