Where can I get free ASP code for a clock with only hh:ss AM/PM ?

Hi Experts,

Where can I get free ASP code for a clock with only hh:ss AM/PM ?

Thanks
LVL 1
indyngAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
Again you have three options:
1. Hope the Regional Settings are set correctly on the server and use something like this: FormatDateTime(Now(), vbLongTime)
2. Write a function to output in the format you need.
3. Use ASP.NET

For option 2, see the code I posted in your related question:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21788965.html
0
Anthony PerkinsCommented:
In case you could not figure it out here it is:

Function GetCurrentTime()
Dim Dat, AMPM

Dat = Now()

If Hour(Dat) < 12 Then
      AMPM = " AM"
Else
      AMPM = " PM"
End If

GetCurrentTime = LPad((Hour(Dat) - 1) Mod 12 + 1) & ":" & LPad(Minute(Dat)) & AMPM

End Function

Function LPad(ByVal Value)

LPad = Right("0" & CStr(Value), 2)

End Function
0
hongjunCommented:
Or are you want to use JavaScript?


<html>

<head>

<script language="JavaScript">
<!--

/*
Live Date Script-
*/


var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' size='1' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
//if (document.all)
document.getElementById('clock').innerHTML=cdate
//else
//document.write(cdate)
}
//if (!document.all)
//getthedate()
function goforit(){
//if (document.all)
setInterval("getthedate()",1000)
}

//-->
</script>

</head>

<body onload="goforit()">
<span id="clock"></span>
</body>

</html>


----
hongjun
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.