The only problem is .... I'm not starting with a Unix timestamp.  The
variable is passed from a form as YYYYmd (or 2001223... no leading zeros in
the month or day).  The PHP date function allows these characters in the
string...

"Y" - 4-digit year,
"n" - month without leading zeros; i.e. "1" to "12"
"j" - day of the month without leading zeros; i.e. "1" to "31"

... so echo date("Y-n-j") would give me the output in the right format, but
I need to convert the input to a valid timestamp first.

Any ideas?? Am I missing something really obvious...it's late and my brain
is tired..

Thanks,

Tim Wright

:::::::::::::::::::::::::::::::::::::::::::
:::                                     :::
:::   Timothy Wright                    :::
:::   mailto:[EMAIL PROTECTED]   :::
:::   Digital Network Enterprises       :::
:::   http://www.01network.com          :::
:::                                     :::
:::   secure e-mail by request          :::
:::   (PGP signature and/or encryption) :::
:::::::::::::::::::::::::::::::::::::::::::


> -----Original Message-----
> From: dmalcolm [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 20, 2001 4:56 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ?
>
>
> Timothy Wright wrote:
>
> > Just wondering...
> >
> > DATE_FORMAT($datevariable, \"%Y%c%e\") works great in a query but I only
> > need to list the date once on the page (as opposed to in each row of the
> > query result) and I don't want to use a second query to MySQL.
> The date is
> > passed to the page as a variable in YYYYmd (month and day as integers)
> > format.
> >
> > Any help greatly appreciated...
> >
> > Tim
> >
> > :::::::::::::::::::::::::::::::::::::::::::
> > :::                                     :::
> > :::   Timothy Wright                    :::
> > :::   mailto:[EMAIL PROTECTED]   :::
> > :::   Digital Network Enterprises       :::
> > :::   http://www.01network.com          :::
> > :::                                     :::
> > :::   secure e-mail by request          :::
> > :::   (PGP signature and/or encryption) :::
> > :::::::::::::::::::::::::::::::::::::::::::
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> Yes.  Take a look at http://www.php.net/manual/en/function.date.php
>
> You're Welcome
> DM
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to