Get Adobe Flash player
דף הבית ג'אווה סקריפט - מתקדם time

getDate()        Returns the date within month (1 to 31).
getDay()         Returns the day within the week (0 to 6).
getFullYear()    Returns the year in local time with four digits.
getHours()       Returns the hour within the day (0 to 23).
getMilliseconds()  Returns the milliseconds.
getMinutes()      Returns the minutes within the hour (0 to 59).
getMonth()        Returns the month within the year (0 to 11).
getSeconds()      Returns seconds within the minute (0 to 59).
getTime()         Returns the number of milliseconds since 1/1/70 00:00:00.
getTimeZoneOffset()  Returns minutes offset from GMT/UTC.
getUTCDate()      Returns the day of the month.
getUTCDay()       Returns the day of the week converted to universal time.
getUTCFullYear()  Returns a four-digit representation of the year converted to universal time.
getUTCHours()     Returns the hour converted to universal time.
getUTCMilliseconds()Returns the milliseconds converted to universal time.
getUTCMinutes()   Returns the minutes converted to universal time.
getUTCMonth()    Returns the month converted to universal time.
getUTCSeconds()   Returns the seconds converted to universal time.
getYear()        Returns number of years since 1900.

parse()  Takes a date string (such as "Jan 21, 1987") and returns the number of milliseconds since January 1, 1970, 00:00:00, local time.

setDate()        Sets the date within the month (1 to 31).
setFullYear()     Sets the year as a four-digit number.
setHours()        Sets hour within day (0 to 23).
setMilliseconds()  Sets the milliseconds.
setMinutes()     Sets the minutes within the hour (0 to 59).
setMonth()       Sets the month within the year (0 to 11).
setSeconds()     Sets the seconds within the minute (0 to 59).
setTime()        Sets the number of milliseconds since 1/1/70 00:00:00

 

דוגמא לשעון:

<script type="text/javascript">

function startTime()
{
var today=new Date();
var d=today.getDay();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();

weekday =["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]

showtime= ((h>12) ? h-12:h) + ":";
showtime+=((m<10) ? "0"+m : m) + ":";
showtime+=(s<10) ?"0"+s:s ;
showtime+= (h>12) ? " PM" : " AM";

document.getElementById('txt').innerHTML="היום יום "+weekday[d]+ "<p> שעה היא: <span dir='ltr'> "+showtime +"</span>";

t=setTimeout('startTime()',500);

}

</script>

 

.

אל השיעור הקודם אל השיעור הבא