Re: function CreateDate i made doesnt work?
| From: | John W. Holmes | Date: | Tue, 06 Apr 2004 18:32:31 +0000 |
| Subject: | Re: function CreateDate i made doesnt work? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182515@lists.php.net to get a copy of this message | ||
From: "Andy B" <aborka1@wmis.net>
> > Replace the above two lines with
> >
> > $time = date('YmdHis', mktime(0,0,0,$month,$day,$year);
> >
>
> ok the function works now because when i echo the output of
> $_SESSION['add']['start_date'] it shows the right 14 digit timestamp for
the
> date i wanted to create... now the problem is getting it to echo on a page
> in a normal "standard user readable format"... i have the following line i
> used to attempt that with but still..no matter what i put in the form for
a
> date it returns monday january 15 2038..or in one instance of playing with
> it even ended up with december 31 1969... even though i put in the date i
> wanted ...
> say "first saturday" 9 (september) 2004
> here is the line i used: something must be wrong with it....
> Start Date: <?echo date("l F j Y",
> $_SESSION['add']['start_date']);?>
date() expects a UNIX timestamp. YYYYMMDDHHMMSS is NOT a UNIX timestamp. So,
instead of converting the UNIX timestamp to YYYYMMDDHHMMSS in your function,
why not leave it a UNIX timestamp? Then you can send it through date()
whenever you want it formatted.
---John Holmes...