Link to home
Start Free TrialLog in
Avatar of UName10
UName10Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Time function needs to be 24 hour format

My page here uses the following code to pull out the start and end times from the database for each event.

It's stored in the database fine in 24 hour time format, but I'm currently just getting the first integer for the hour and minute (e.g. '19 0' instead of '19:00').

Here's the part that handles the time:

  <div class="time">
      <div class="hour"><%=hour(rs("ca_starttime"))%></div>
      <div><%=minute(rs("ca_starttime"))%></div>
   </div> 

<div class="time">
      <div class="hour"><%=hour(rs("ca_endtime"))%></div>
      <div><%=minute(rs("ca_endtime"))%></div>
   </div> 

Open in new window


Many thanks.
ASKER CERTIFIED SOLUTION
Avatar of wobbled
wobbled
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of UName10

ASKER

Hi wobbled - thanks very much.

That's a good solution, I just added the following suggestion:
<%=Right("00" & minute(rs("ca_starttime")), 2)%>

Open in new window


Yours would work too however, so I'll accept that as the solution.

Many thanks.