|
Posted by Otis on 09/10/07 07:05
Thank you for your (civil) reply.
Yes, I finally figured out about the timestamps.
But I must tell you that the PHP documentation for date stuff stinks.
Who needs silly examples on how to get current date and time? Those
examples are worthless, practically speaking. There are few or no
examples of how to do things with different dates other than current
dates. On this issue, VB documentation beats the heck out of PHP
documentation. I have several books on PHP and they all do a lousy job
when talking about dates and times. They must think that the real world
only deals with current dates and times. Very poor.
But with your help and JW's, it lead me to the apparent right solution.
Thank you.
Otis
NC wrote:
> On Sep 4, 12:38 am, Otis <otie_nos...@cox.net> wrote:
>> PHP is driving me mad with their idiotic way of dealing with
>> dates and date conversions - unless I'm the idiot.
>
> No, you just didn't read the documentation.
>
>> Let's assume the date is $d = "09/03/1951" - Sep 3, 1951
>> How do I get just the year from a date like Sep 3, 1951?
>> How do I get just the day from a date like Sep 3, 1951?
>> How do I get just the month from a date like Sep 3, 1951?
>
> $d = "09/03/1951";
> $ts = strtotime($d);
> $year = date('Y', $ts);
> $month = date('m', $ts);
> $day = date('d', $ts);
>
>> I have never been able to get PHP to deal properly with
>> the years since it seems to have the stupid habit of
>> deciding for itself whether a year is 2000 something or
>> 1900 something. It apparently only wants to deal with
>> 2-digit years.
>
> You are mistaken. PHP wants to deal with timestamps.
>
> Cheers,
> NC
>
Navigation:
[Reply to this message]
|