Solved

how to remove seconds in time and retain the AM or PM

Posted on 2003-11-10
4
1,453 Views
Last Modified: 2008-02-01
how to remove seconds in time and retain the AM or PM

sample:

8:05:30 AM  or  7:45:00 PM

i want to show only the hours, minutes and AM or PM.

8:05 AM  or  7:45 PM

thanks
0
Comment
Question by:ziaguintu5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
ho_alan earned 23 total points
ID: 9720255
newTime = FormatDateTime(Date(),4)
result = newTime
newHour = Hour(newTime)
if newHour > 11 then
       result = newHour & ":" minute(newTime) & "PM"
else
       result = newHour & ":" minute(newTime) &"AM"
end if
0
 
LVL 2

Assisted Solution

by:Sairam_S
Sairam_S earned 22 total points
ID: 9720287
<%
  sTime = "8:05:30 AM"
 
  sTimeArr = Split(sTime, " ")
  sTimeAlone = Split(sTimeArr(0), ":")

  sTime = sTimeAlone(0) & ":" & sTimeAlone(1) & " " & StimeArr(1)
  Response.Write sTime
%>
0
 
LVL 7

Expert Comment

by:vnvk
ID: 12046636
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Split: ho_alan {http:#9720255} & Sairam_S {http:#9720287}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

vnvk
EE Cleanup Volunteer
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question