Re: Numbers to Date
| From: | Jason Wong | Date: | Fri, 16 May 2003 18:43:33 +0000 |
| Subject: | Re: Numbers to Date | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147959@lists.php.net to get a copy of this message | ||
On Saturday 17 May 2003 02:39, zavaboy wrote:
> How do I use what I have with the mktime() function?
>
> as a test, here's what I have:
> $Date = date("yz");
> //Getting today's date in 5 digit format
> $Date = str_pad($Date, 5, "0", STR_PAD_RIGHT); //Stuffing any epty
> places
> $Year = substr("$Date", 0, 2);
> //Getting year
> $Day = substr("$Date", 2, 5);
> //Getting day of year
> $ReDate = mktime (0,0,0,0,$Day,$Year); //Making
> timestamp
> $TrueDate = date("l, F j, Y", $ReDate); //Putting
> in desired format
> print ("$TrueDate");
> //Print the result
>
> Output: Monday, April 14, 2003 ... That's not right for today's date!
Use 1 for the month:
$ReDate = mktime (0,0,0,1,$Day,$Year); //Making
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You can be replaced by this computer.
*/