|
-
Sep 23rd, 2002, 08:25 AM
#1
Thread Starter
Addicted Member
Equivalent date functions in PHP ?
Hi there,
Got another question about PHP. I've succeeded in converting most of my ASP functions to PHP, but I don't understand quite well how date works.
Suppose i have a string, say $strTmp = '2002-01-12', how can i tell PHP this is a date ( Like CDate() ) and then extract month, day, year from it ?
Thanks in advance !
-
Sep 23rd, 2002, 01:10 PM
#2
Frenzied Member
you can explode that string at the "-" and then use the month day and year or you can use date like so
$the_date = date(Y,m,d);
or
$year = date(Y);
$month = date(m);
$year = date(d);
-
Sep 23rd, 2002, 07:38 PM
#3
Stuck in the 80s
Re: Equivalent date functions in PHP ?
Originally posted by eL_NiNo
Hi there,
Got another question about PHP. I've succeeded in converting most of my ASP functions to PHP, but I don't understand quite well how date works.
Suppose i have a string, say $strTmp = '2002-01-12', how can i tell PHP this is a date ( Like CDate() ) and then extract month, day, year from it ?
Thanks in advance !
The PHP documentation can be a valuable resource: http://www.php.net/
You can find information on the date function here: http://www.php.net/manual/en/function.date.php
As for telling PHP it's a date, that doesn't matter. There aren't specified variable types in PHP. Just as long as it's the right format for date, PHP will recognize it.
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
|