Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy only dates 3 89
Use a variable for Class Name in Classic ASP 4 56
INNER JOIN ? 8 47
age from date of birth 4 42
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

809 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