Date ႏွွင္႕ Current Time ထည္႕နည္းမ်ား

Posted by မုိးထက္ျမင္႕ Tuesday, September 15, 2009 0 comments

ကြၽန္ေတာ္ Blog မွာလုိ ရက္စြဲ နဲ႕ ေန႔ ထည္႕ခ်င္တဲ႕ သူငယ္ခ်င္းမ်ား အသုံးျပဳလုိ႕ ရေအာင္ ကြၽန္ေတာ္ တင္ျပေပးလုိက္ပါတယ္။ အခုလုိ တင္ေတာ႕ Sidebar Widget မွာ ေနရာ ယူတာ ေလ်ာ႕သြားတာေပါ႔။ ျပကၡဒိန္ထည္႔မဲ႕ အစား အခုလုိေလး တုိတုိ တုတ္တုတ္ ထည္႕ခ်င္တယ္ဆုိရင္ေတာ႕ ေအာင္က နည္းမ်ားကုိ အသုံးျပဳႏုိင္ပါတယ္။
နည္းလမ္း (၁)
1. Layout >> Page Elements >> Add a Gadget >> HTML / JavaScript စတဲ႕အတုိင္း အဆင္႕ဆင္႕ သြားလုိက္ပါ။ ေအာက္က code ေတြကုိ ထည္႕လုိက္ပါ။

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

var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

var monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

var now = new Date

document.write("Today is " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +".")

//-->
</script>

နည္းလမ္း (၂)
1. Layout >> Page Elements >> Add a Gadget >> HTML / JavaScript စတဲ႕အတုိင္း အဆင္႕ဆင္႕ သြားလုိက္ပါ။ ေအာက္က code ေတြကုိ ထည္႕လုိက္ပါ။

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

var now = new Date

document.write(now.getDate() + "/" + now.getMonth() + "/" + now.getYear())

//-->
</script>

နည္းလမ္း (၃)
1. Layout >> Page Elements >> Add a Gadget >> HTML / JavaScript စတဲ႕အတုိင္း အဆင္႕ဆင္႕ သြားလုိက္ပါ။ ေအာက္က code ေတြကုိ ထည္႕လုိက္ပါ။

<script>
atoj = new Date();
atoj1= atoj.getHours();
atoj2 = atoj.getMinutes();
atoj3= atoj.getSeconds();

if(atoj1==0){atoj4=" AM";atoj1=12}
else if(atoj1 <= 11){atoj4=" AM"} else if(atoj1 == 12){atoj4=" PM";atoj1=12} else if(atoj1 >= 13){atoj4=" PM";atoj1-=12}

if(atoj2 <= 9){atoj2="0"+atoj2} document.write(""+atoj1+":"+atoj2+":"+atoj3+""+atoj4+""+"");
</script>


Image and video hosting by TinyPic

Read more: http://www.knowledgewar07.com/2009/10/archives-title-post.html#ixzz0mW6Uw3Wc

0 Responses so far.

Post a Comment