Solved

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

Posted on 2003-11-10
4
1,443 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
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now