Re: JavaScript question
by 2Nerotik <2nerotik(at)nisa.net>
|
Date: |
Sun, 06 Feb 2000 12:21:06 -0800 |
To: |
hwg-techniques(at)hwg.org |
In-Reply-To: |
earthlink |
|
todo: View
Thread,
Original
|
|
Q: are you trying to make ampm be either am or pm or are you checking ampm
to see if it's am or pm.
ampm = am ~ makes it equal to
ampm == am ~ checks if it's equal to
so
ampm = am
if (hr > 12) {
hour = hr -12
ampm = pm
}
I learned this the other day when doing a screen width check, I was trying to
use ~ if (screen.width = 800) do this, which gave me errors because if should
have been ~ if (screen.width == 800) do this.
see the difference, in the first I'm trying to make screen.width be 800 whereas
the second checks to see IF screen.width is 800.
PS: I can't remember but isn't there a zero hundred hours in military time that
you will need to check for as well. I can't quite remember but I think
there is.
At 10:42 AM 06/02/2000 -0800, RHoltzworth wrote:
>Hello
>
>I'm trying to teach myself JavaScript. I want to display the day, date,
>and time of the local PC (this will later go into a hidden field of a
>form). I've finally got the day, date the way I want it, but I can't get
>the time to work. I want the hour to display in clock time as opposed to
>military time. Also I want to add an "am" or "pm" as well. I thought
>using a simple "if" statement would work:
>
>// display time
>
>var hr = today.getHours()
>var min = today.getMinutes()
>ampm == am
> if (hr > 12) {
> hour = hr - 12
> ampm == pm
>}
>
>I know I need to change the document.write statement, but this code
>makes everything undefined. Any ideas would be helpful.
>
>http://www.cgi101.com/~rbh97/DateandTime.html
>
>TIA
>
>Rich
>
>
>
>Date and Time....
>
>
>
>
>
>----------
>
>
.oOo.
|| The force. It surrounds us. It enfolds us.
|| It gets us dates on Saturday nights.
||
|| Addicted 2 Swing ---> http://www.nisa.net/~2nerotik/
|| Fontaholic ? ---> http://www.fontsanon.com
|| HTML Writers Guild ---> http://www.hwg.org
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA