473,383 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How do I convert the time to HH:MM am/pm from database's HH:M:SS?

I'm using Dreamweaver CS5 and my recordset looks like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT database.`TIME`
  2. FROM database
  3. ORDER BY database.`TIME`
  4.  
All of the times are input into the database as HH:MM:SS, so they are returned that way. I need to have them displayed on my web page as HH:MM AM or PM.

Obviously, I'm new to this. Any ideas?

Thanks!
Oct 13 '10 #1
4 4448
JKing
1,206 Expert 1GB
You can use the DATE_FORMAT function. http://dev.mysql.com/doc/refman/5.1/...on_date-format
Oct 13 '10 #2
Got it. Now where does it go in my code?

SELECT DATE_FORMAT('2007-10-04 22:23:00', '%h:%i %p');

Does it go in my recordset somewhere?

SELECT database.`TIME`
FROM database
ORDER BY database.`TIME`

Thanks for your help!
Oct 13 '10 #3
JKing
1,206 Expert 1GB
You use the function on your time field.

Expand|Select|Wrap|Line Numbers
  1. SELECT DATE_FORMAT(database.`TIME`, '%h:%i %p')
  2. FROM database
  3. ORDER BY database.`TIME`
  4.  
Oct 13 '10 #4
When I test it through Dreamweaver's recordset test, it works, but when I implement it onto the page, it gives me errors.

Undefined index: DATE_FORMAT(schedule.`TIME'in C:\wamp\www\mysite.php on line 288
Oct 13 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: hikums | last post by:
Does anyone have a function to convert duration in seconds to a format hh:mm:ss Thanks.
1
by: mimi | last post by:
my database has separate field for date and time so we can capture employees' time in and out . In Sql, date can be present in smalldatetime format, which contains only time hh:mm:ss AM/PM. How...
2
by: D. Shane Fowlkes | last post by:
Here's a good one. I've been using an Excel spreadsheet for the past couple of years to calculate a file's Estimated Download Time based off of a solid 50kbs connection (dial up). This is for a...
14
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks in advance!
5
by: kpp9c | last post by:
Hi, I was looking at python & datetime and hoping that it would already have a method/func to translate time formats. I need to translate seconds to hh:mm:ss.ms and vice versa and would like...
4
by: tony | last post by:
Hello! I have this method ConvStdTimeToSec here that convert format hh:mm:ss into total number of seconds and return it. I just wonder if there exist a metod in the .NET framework that can be...
5
nirmalsingh
by: nirmalsingh | last post by:
i am getting date format in string as 30-11-2006 05:59:44 PM . i want to convert in the format of yyyy-mm-dd hh:mm:ss to sore it in mysql database. Help me with sample coding plz..
1
by: unknown66 | last post by:
hello, I have a time value in unix time that I would like to convert into a time format of hh:mm:ss:ms. For example, I have this number, 1172234138451, that I would like to be in the hh:mm:ss:ms...
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.