WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-11-2004, 03:53 PM
northernladuk northernladuk is offline
WebProWorld Pro
 

Join Date: Jun 2004
Location: UK
Posts: 118
northernladuk RepRank 0
Default Date and time from MySql without seconds

I am using MySQL and saving the time using the datetime function but this saves HH:mm:ss.

How can I view the time on the webpaeg without the seconds? Can I do it with a function to drop the seconds or do I have to do something with the MySQL so it doesn't save the seconds in the first place?

many thank
Reply With Quote
  #2 (permalink)  
Old 08-11-2004, 07:43 PM
redcircle's Avatar
redcircle redcircle is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 553
redcircle RepRank 0
Default

Assuming you are using PHP you can convert the MySQL into a unixtimestamp and output from there.

Code:
<?php
$unix = strtotime('2004-08-10 22:33:21');  //puts the mysql datetime into unix timestamp this probably can be done within mysql also
$datetime = date('F j Y h:ia',$unix); //removes seconds and adds either am/pm accordingly if you want 24hr time use a capital H for hour
?>
__________________
www.squitosoft.com - PHP development site. featuring Squito Gallery. a php driven photo gallery.
www.rgfx.net - Specializing in Internet solutions, including Html authoring, Interactive Web sites, 3D/2D Graphics and animation.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: date, mysql, seconds, time, without



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0