Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How can I get the format dd:mm:yy hh:nn AMPM from dd:mm:yy hh:nn:ss AMPM?

Posted on 2006-04-03
2
Medium Priority
?
713 Views
Last Modified: 2011-09-20
Hi Experts,

How can I get the format dd:mm:yy hh:nn AMPM  from dd:mm:yy hh:nn:ss AMPM?

Basically I want the seconds to drop out.

Thanks
0
Comment
Question by:indyng
2 Comments
 
LVL 8

Accepted Solution

by:
esw074 earned 2000 total points
ID: 16367564

<% timestring = "04/04/06 04:14:03 AM" %>

<%  Private Function FormatTimeNoSeconds(strTime)
    On Error Resume Next

    'Store the Time
    Dim DT
    DT = TimeValue(strTime)
    DD = datevalue(strTime)
      

    'Strip out the seconds
    Dim TimePart
    TimePart = Left(DT, Len(DT) - 6)

    'Get the AM/PM designation
    Dim AMPMPart
    AMPMPart = Right(DT, 3)

    'Rebuild the string
    FormatTimeNoSeconds = DD & " " & TimePart & AMPMPart
End Function
%>


Usage:
<%=formattimenoseconds(timestring)%>

Should return 04/04/06 4:14 AM

0
 
LVL 6

Expert Comment

by:ksbhat
ID: 16368521
Dim Time
Dim TimePart
Dim TimeSplit

Time = FormatDateTime(Now(), 3)

TimePart = split(Time," ")
TimeSplit = split(TimePart(0),":")

Response.write date() & " " & TimeSplit(0) & ":" & TimeSplit(1) & " " & TimePart(1)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

571 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