Re: Re: [PHP] String to Date and Date to String Functions?
| From: | Ben Edwards | Date: | Mon, 24 Jan 2005 19:01:01 +0000 |
| Subject: | Re: Re: [PHP] String to Date and Date to String Functions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207144@lists.php.net to get a copy of this message | ||
On Mon, 24 Jan 2005 12:58:52 -0500, hitek@cox.net <hitek@cox.net> wrote:
> How about the strtotime() function?
> http://us4.php.net/manual/en/function.strtotime.php
No good, it douse not take a format string. What if I wanted to
convert the timestamp to 'DD-MM-YYY', display it on a form, validate
it, and then convert it back to a timestamp.
I cant beleve the PHP date/time functions suck this bad;(
Ben
> > From: Ben Edwards <funkytwig@gmail.com>
> > Date: 2005/01/24 Mon PM 12:03:34 EST
> > To: Jay Blanchard <jay.blanchard@niicommunications.com>
> > CC: PHP General List <php-general@lists.php.net>
> > Subject: Re: [PHP] String to Date and Date to String Functions?
> >
> > On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> > <jay.blanchard@niicommunications.com> wrote:
> > > [snip]
> > >
> > > String to Date Function
> > > ----------------------------
> > > return date stringToDate( str Date, str Format )
> > > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/YYYY' );
> > >
> > > Date to String Function
> > > ----------------------------
> > > return str dateToString( date Date, str Format )
> > > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/YYYY' );
> > >
> > > Anyone know of any functions that do this or have pointers as to how
> > > it can be done.
> > > [/snip]
> > >
> > > You've looked at http://www.php.net/date ?
> > >
> > Yes. It douse the dateToString bit but how do I do the reverse. I
> > can use it to convert a timestamp to a string but how do I convert a
> > string to a timestamp.
> >
> > I must say i've used a few languages in my time and the PHP data/time
> > functions are a mess. Generaly when you find a function to do
> > something to a data item there is an obvious way of reversing this
> > (i.e. it has a simeler name). This douse not seem to be the case with
> > PHP;(
> >
> > Ben
> >
> > --
> > Ben Edwards - Poole, UK, England
> > WARNING:This email contained partisan views - dont ever accuse me of
> > using the veneer of objectivity
> > If you have a problem emailing me use
> > http://www.gurtlush.org.uk/profiles.php?uid=4
> > (email address this email is sent from may be defunct)
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)