[CLUE-Tech] PHP or MySQL date handling problem
Lynn Danielson
lynnd at techangle.com
Fri Jun 14 12:00:22 MDT 2002
Jed S. Baer wrote:
> Lynn Danielson wrote:
> > Jed S. Baer wrote:
> > > I've run into a problem with PHP or MySQL (or both) with the handling
> > > of dates. The problem is that neither of them provides a generalized
> > > date/time parser that accepts a format string. <snip>
> >
> > PHP's date() function allows you to format a Unix integer timestamp
> > into a string of your choice. It's very flexible and has met all
> > of my needs. You can use time(), strtotime() or mktime() functions
> > to feed it timestamps.
>
> Thanks Lynn, but nope. I have the string. I need to convert it to
> something that works for MySQL. No PHP function accepts a date/time
> string and a format string. (Look at man strptime. ...)
Ok. I did look at strptime and I'm not getting your problem. If I'm
understanding correctly, you have a date string and want to convert it
into a MySQL compatible datetime or timestamp input format.
If it's the tm structure you're looking for, an equivalent hash could
be constructed using PHP's date("format", strtotime("date/time string"))
functions. I can't see what strptime gives me that a combination of
PHP's date() and strtotime() do not. Please enlighten me.
Lynn
More information about the clue-tech
mailing list