Data

Data 00/00/2009

Data w układzie Dzień/Miesiąc/Rok

<script language="javascript">
<!-- W3e JAVAScript Preset/Date
var DDMMYY =0
var MMDDYY =1

function getdate(mode)
{
   var now = new Date();
   var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
   if (mode==DDMMYY)
      var MonthDayYear =(dayNr+"/"+(now.getMonth()+1)+"/"+now.getFullYear());
   else
      var MonthDayYear =((now.getMonth()+1)+"/"+dayNr+"/"+now.getFullYear());

   return MonthDayYear;
}

function gettime()
{
   var now = new Date();

   var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
   var hours = now.getHours();
       hours = ((hours > 12) ? hours - 12 : hours);

   var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
   var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
   var TimeValue =(" " + hours + minutes + seconds + " "  + ampm);

   return TimeValue;
}//-->
</script>
<script language="javascript">document.write(getdate(DDMMYY));</script>

Lub drugi ładny sposób zastosowania podobnego skryptu

Dzisiaj jest:

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide it
// Returns today's date in a string with full day and month names
// by Roger C. Scudder Jr. on 10-2-98
// corrected for Netscape by Grzegorz Golebiewski
DayName = new Array(7)
DayName[0] = "niedziela "
DayName[1] = "poniedziałek "
DayName[2] = "wtorek "
DayName[3] = "środa "
DayName[4] = "czwartek "
DayName[5] = "piątek "
DayName[6] = "sobota "

MonthName = new Array(12)
MonthName[0] = "stycznia "
MonthName[1] = "lutego "
MonthName[2] = "marca "
MonthName[3] = "kwietnia "
MonthName[4] = "maja "
MonthName[5] = "czerwca "
MonthName[6] = "lipca "
MonthName[7] = "sierpnia "
MonthName[8] = "września "
MonthName[9] = "października "
MonthName[10] = "listopada "
MonthName[11] = "grudnia "

function getDateStr(){
    var Today = new Date()
    var WeekDay = Today.getDay()
    var Month = Today.getMonth()
    var Day = Today.getDate()
    var Year = Today.getFullYear()

    if(Year <= 99)
        Year += 1900

    return DayName[WeekDay] + "," + " " + Day + " " + MonthName[Month] + ", " + Year
}
//-->
</SCRIPT>

<SCRIPT>document.write("Dzisiaj jest " + getDateStr())</SCRIPT>

Zobacz efekt

Projekt © 2009 - INFOPROG 68667 odwiedzin