Re: Numbers to Date
| From: | zavaboy | Date: | Fri, 16 May 2003 19:15:39 +0000 |
| Subject: | Re: Numbers to Date | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147966@lists.php.net to get a copy of this message | ||
You're right!
So I fixed it:
//Compile date number
$YearA = date("y");
$DayA = date("z");
$DayA = str_pad($DayA, 3, "0", STR_PAD_LEFT);
$Date = YearA . DayA;
//Get full date
$Year = substr("$Date", 0, 2);
$Day = substr("$Date", 2, 5);
$ReDate = mktime (0,0,0,1,$Day+1,$Year);
$TrueDate = date("l, F j, Y", $ReDate);
print ("$TrueDate");
"Cpt John W. Holmes" <holmes072000@charter.net> wrote in message
news:005201c31bdf$0577cc60$a629089b@TBHHCCDR...
> Your number system is screwy.
>
> Is 03100 the first day, tenth day, or the hundreth??
>
> ---John Holmes...
>
> ----- Original Message -----
> From: "Leif K-Brooks" <eurleif@buyer-brokerage.com>
> To: "zavaboy" <zavaboy@hotmail.com>
> Cc: <php-general@lists.php.net>
> Sent: Friday, May 16, 2003 2:39 PM
> Subject: Re: [PHP] Numbers to Date
>
>
> > $date = '03135';
> > $year = substr($date,0,2); //Set $year to first two digits
> > $days = substr($date,2); //Set $days to the rest
> > $date = strtotime("january 1 $year +$days days"); //Set $date to
> > timestamp of that date
> > echo date('l, F j, Y',$date); //Echo formatted date
> >
> > zavaboy wrote:
> >
> > >This does have a little to do with my other post... the fact that we're
> > >talkin about 5 digits... Anyway, I want to change a 5 digit number to a
> full
> > >date:
> > >
> > >For example...
> > >
> > >The number:
> > >03135 //(Today) The first 2 digits indacate the year
> and
> > >the last 3 indacate the day of the year (if the day is 1 or 2 digits it
> will
> > >fill in the blanks with 0 eg: 03500 is Jan 5)
> > >
> > >I want PHP to find out the date and put it in this format: "Friday, May
> 16,
> > >2003" (no quotes) ( as if I used: date("l, F j, Y") )
> > >
> > >I'm stumped on how to do this... Any help?
> > >
> >
> > --
> > The above message is encrypted with double rot13 encoding. Any
> unauthorized attempt to decrypt it will be prosecuted to the full extent
of
> the law.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>