1
Kyle
Changing a Javascript clock from Japanese to English
  • 2005/7/27 12:36

  • Kyle

  • Posts: 0

  • Since:


Ive got a clock in a template thats in Japanese, I cant quite figure out how to convert it to english

<Script Language="JavaScript">
<!--
var spSTim11="¡¡";
function time01() {
var dayTim,jiTim,funTim,byoTim,goze;
dayTim=new Date();
jiTim=dayTim.getHours();
funTim=dayTim.getMinutes();
byoTim=dayTim.getSeconds();
if (jiTim<12) goze="¸AM° ";
else {
goze="¸PM ";
jiTim=jiTim-12;
}
document.time01.timeform.value=spSTim11+goze+jiTim+"»þ"+funTim+"ʬ"+byoTim+"ÉÃ";
setTimeout("time01()",1000);
}
// End -->

Any help would be greatly appreciated! All i could see to change was AM or PM!

2
davidthomas1
Re: Changing a Javascript clock from Japanese to English

Just change the characters in this string :

document.time01.timeform.value=spSTim11+goze+jiTim+"»þ"+funTim+"ʬ"+byoTim+"ÉÃ";


and take out the Japanese characters.

It may look like this :

document.time01.timeform.value=jiTim+":"+funTim+":"+byoTim+" "+goze;



hope it helps,

D.
みんなちがってみんないい。

XOOPS 2.0.13.2

3
topgod6
Re: Changing a Javascript clock from Japanese to English
  • 2005/7/27 20:01

  • topgod6

  • Just popping in

  • Posts: 30

  • Since: 2005/7/27


I figured out the bits to change but when the time goes to like 5 past the hour its displayed as 5:5 instead of 5:05

4
davidthomas1
Re: Changing a Javascript clock from Japanese to English

change this line:

funTim=dayTim.getMinutes();


to

funTim = ((dayTim.getMinutes() < 10) ? ":0" ":") + dayTim.getMinutes();


The code checks if the minute value is less than 10 and adds the extra zero accordingly.

D.
みんなちがってみんないい。

XOOPS 2.0.13.2

Login

Username:
Password:

Lost Password? Register now!

Who's Online

70 user(s) are online (45 user(s) are browsing Support Forums)


Members: 1


Guests: 69


heyula,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits