On Tue, 2002-02-05 at 18:44, Gary wrote:
> Hello All,
>   Can someone please RTFM me so I can convert MySQL 24 hour time to 12 
> hour time.
> TIA
> gary

Use MySQL's date_format() function with the %r specifier in your query:

  shanna% mysql 
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 2401 to server version: 3.22.32-log
  
  Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  
  mysql> select date_format(now(), '%T');
  +--------------------------+
  | date_format(now(), '%T') |
  +--------------------------+
  | 20:17:30                 |
  +--------------------------+
  1 row in set (0.00 sec)
  
  mysql> select date_format(now(), '%r');
  +--------------------------+
  | date_format(now(), '%r') |
  +--------------------------+
  | 08:17:39 PM              |
  +--------------------------+
  1 row in set (0.00 sec)
  
  mysql> quit
  Bye
  
  shanna% 

This is documented at:

  http://www.mysql.com/doc/D/a/Date_and_time_functions.html

Your query would then be something like the following, assuming a table
named my_table and a date/time column named my_column:

  select date_format(my_column, '%r') from my_table

Alternatively, select the date as a timestamp and feed it to strftime():

  http://www.php.net/strftime


Hope this helps,

Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to