Tuesday, September 15, 2009

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

ကြၽန္ေတာ္ 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>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Top WordPress Themes