Re: Translating MySQL timestamp to datetime

From: Joshua Beall (jbeall_at_donotspam.remove.me.heraldic.us)
Date: 04/22/04


Date: Thu, 22 Apr 2004 13:37:05 GMT


"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:hehf80tvedssi6vpt7k9qij4hl0j2o2og3@4ax.com...
> I noticed that Message-ID: <MxPhc.44294$L31.36599@nwrddc01.gnilink.net>
> from Joshua Beall contained the following:
>
> >I already tried date("Y-m-d H:i:s",strtotime("20040422090941")), and had
no
> >luck. strtotime cannot handle that format.
>
> Try converting it to a UNIX timestamp in the query e.g
> SELECT UNIX_TIMESTAMP(mysql_timestamp)) AS unixtimestamp...

Is this function an ANSI standard? Or a MySQL specific extension?

I try to avoid the MySQL specific stuff. Not religiously, but when
alternatives exist, I opt for the standards-compliant way of doing it.



Relevant Pages

  • Re: date format
    ... I don't believe this IS a MySQL question at all. ... not rely on Javascript to sanitize your ... you end up with the Epoch is a safe format. ... (presumably as a result of a form post), it must have come from the ...
    (comp.lang.php)
  • Re: [PHP] strtotime problem
    ... why don't you have MySQL do all the magic for you? ... will give you the date-time in "mysql format" or any other format ... Since the format used here is dd/mm/yyyy I can't use the strtotime directly bacause as far as I know from the documentation I don't think that it changes with the timezone. ...
    (php.general)
  • Re: Dating Advice
    ... >>format it wont work. ... >>b) mysql has some sort of command telling it that the date is actually ... > field is of some string type, you can use MySQL's string functions to ...
    (comp.lang.php)
  • Re: Dumb Question of the day (maybe year)
    ... 2001-21-06 is not a correctly formatted MySQL date. ... The correct format is: YYYY-MM-DD ... functionality as these functions are local to the data, ...
    (alt.php)
  • Re[2]: [PHP] strtotime problem
    ... why don't you have MySQL do all the magic for you? ... And fill 'timeconfirm' in onchange/onkeypress event, using verbal format like ... to use the fixed format dd/mm/yyyy and I can't use other input formats ... you should either force user to use specific format ...
    (php.general)