°£´ÜÇÑ setUTCDate °øÅë ¿¹Á¦
<SCRIPT>
var br='<BR>'; // ÁٹٲÞ
var str=''; // Ãâ·Â ¹®ÀÚ¿ º¯¼ö ¼±¾ð
var now=new Date(); // ÇöÀç ½Ã°£À» º¯¼ö¿¡ ÇÒ´ç
str+='now=new Date()'+br; // ÇöÀç½Ã°£ º¯¼ö ¼³Á¤ ³»¿ª º¸¿©ÁÜ
str+='now.toLocaleString()='+now.toLocaleString()+br+br; // ÇöÀç ½Ã°£ Ãâ·Â
now.setUTCDate(0); // »õ·Î¿î ÀÏÀÚ 0ÀÏÀ» ¼³Á¤, 0ÀÏÀÌ ¾øÀ¸¹Ç·Î ÇØ´ç ¿ù 1ÀϺ¸´Ù Çϳª ÀÛÀº Àü¿ù ¸¶Áö¸· ÀÏÀÚ°¡ µÈ´Ù.
str+='now=setUTCDate(0)='+now+br; // °á°ú ½Ã°£ Ãâ·Â
str+='now.toLocaleString()='+now.toLocaleString()+br+br; // °á°ú ÇöÁö ½Ã°£ Ãâ·Â
now.setUTCDate(41); // »õ·Î¿î ÀÏÀÚ 41·Î ¼³Á¤, ¹üÀ§¸¦ ÃÊ°úÇϹǷΠÇØ´ç ¿ùÃʺÎÅÍ 41ÀÏ °è»êÇÏ¿©, ³âµµ, ¿ù, ÀÏÀÌ »êÁ¤µÈ´Ù
str+='now=setUTCDate(11)='+now+br; // °á°ú ½Ã°£ Ãâ·Â
str+='now.toLocaleString()='+now.toLocaleString()+br+br; // °á°ú ÇöÁö ½Ã°£ Ãâ·Â
now.setUTCDate(-15); // »õ·Î¿î ÀÏÀÚ -15ÀÏÀ» ¼³Á¤, ÇØ´ç ¿ùÃʺÎÅÍ °è»êÇÏ¿© ³âµµ, ¿ù, ÀÏÀÌ °è»êµÈ´Ù
str+='now=setUTCDate(-15)='+now+br; // °á°ú ½Ã°£ Ãâ·Â
str+='now.toLocaleString()='+now.toLocaleString()+br+br; // °á°ú ÇöÁö ½Ã°£ Ãâ·Â
document.write(str); // °á°ú ¹®ÀÚ¿ Ãâ·Â
</SCRIPT>
UTC ÀÏÀÚ, ½Ã°£ ¼³Á¤ ¿¹Á¦ °øÅë ÄÚµå
<SCRIPT>
var br='<BR>',str=''; // ÁٹٲÞ, Ãâ·Â ¹®ÀÚ¿ º¯¼ö ¼±¾ð
var now=new Date(); // ÇöÀç ½Ã°£À» ¾ò´Â´Ù;
function showNewUTC(){
str+='now=<FONT color=green>'+now+'</FONT> : ';
str+='now.toLocaleString()=<FONT color=blue>'+now.toLocaleString()+'</FONT>'+br;
}
</SCRIPT>
UTC ÀÏÀÚ ¼³Á¤ ¸Þ¼µå ¿¹Á¦
<SCRIPT>
var now=new Date(); // ÇöÀç ½Ã°£À» ¾ò´Â´Ù;
str='now=new Date()'+br;showNewUTC(); // ÇöÀç ½Ã°£ Ãâ·Â
now.setUTCFullYear(2004); str+=br+'now,setUTCFullYear(2004)'+br;showNewUTC(); // ÇöÀç ³âµµ¿¡ »õ ¼öÄ¡ ¼³Á¤
now.setUTCMonth(5); str+='now.setUTCMonth(5)'+br; showNewUTC();
now.setUTCDate(1); str+='now.setUTCDate(1)'+br; showNewUTC();
now.setUTCHours(15); str+=br+'now.setUTCHours(15)'+br; showNewUTC();
now.setUTCMinutes(15); str+='now.setUTCMinutes(15)'+br; showNewUTC();
now.setUTCSeconds(5); str+='now.setUTCSeconds(5)'+br; showNewUTC();
now.setUTCMilliseconds(25); str+='now.setUTCMilliseconds(25)'+br; showNewUTC();
document.write(str); // °á°ú ¹®ÀÚ¿ Ãâ·Â
</SCRIPT>
UTC ÀÏÀÚ, ½Ã°£ ´ÜÃà ¼³Á¤ ¿¹Á¦
<SCRIPT>
var now=new Date(); // ÇöÀç ½Ã°£À» ¾ò´Â´Ù;
str='now=new Date()'+br; showNewUTC();+br; // ÇöÀç ½Ã°£ Ãâ·Â
now.setUTCFullYear(2005,4,5); str+='now.setUTCFullYear(2005,4,5)'+br; showNewUTC();+br; // ÇöÀç ³âµµ¿¡ »õ ¼öÄ¡ ¼³Á¤
now.setUTCHours(11,11,11,111); str+='now.setUTCHours(11,11,11,111)'+br; showNewUTC();
document.write(str); // °á°ú ¹®ÀÚ¿ Ãâ·Â
</SCRIPT>
|