Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-10
4
Medium Priority
?
1,455 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
3 Comments
 
LVL 5

Accepted Solution

by:
ho_alan earned 92 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 88 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

782 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