07.09.2009, 10:40
Ich suche seit gestern in diversen Foren, wie ich das Zeitformat ändern kann.
Irgendwo habe ich das schon mal gelesen, aber ich finde das einfach nicht mehr.
Möchte einfach das "PM" oder "AM" nicht haben.
Irgendwo habe ich das schon mal gelesen, aber ich finde das einfach nicht mehr.
Möchte einfach das "PM" oder "AM" nicht haben.
Zitat:<html>
<head><title>newclock</title></head>
<style>
SPAN#clock
{
font-family: Lucida Sans;
color: #696969;
font-weight: Bold;
font-size: 20;
text-shadow: #000000 0px 0px 0px;
}
SPAN#ampm
{
font-family: Lucida Sans;
font-weight: Bold;
color: #696969;
font-size: 15px;
text-shadow: #000000 0px 0px 0px;
}
TD#date
{
font-family: Lucida Sans;
text-align: center;
/*font-weight: Bold;*/
color: #696969;
font-size: 13px;
text-shadow: #000000 0px 0px 0px;
}
</style>
<script type="text/javascript">
<!--
var this_weekday_name_array = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var this_month_name_array = new Array("January","February","March","April","May","June","July","August","September","October","November","December") //predefine month names
var this_date_timestamp = new Date()
var this_weekday = this_date_timestamp.getDay()
var this_date = this_date_timestamp.getDate()
var this_month = this_date_timestamp.getMonth()
var this_year = this_date_timestamp.getYear()
if (this_year < 1000)
this_year+= 1900;
if (this_year==101)
this_year=2001;
var this_date_string = this_weekday_name_array[this_weekday] + ", " + this_month_name_array[this_month] + " " + this_date //concat long date string
// -->
function init ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("clock").appendChild ( timeDisplay );
}
function updateClock ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes;
// Update the time display
document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
function init2 ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("ampm").appendChild ( timeDisplay );
}
function amPm ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = timeOfDay;
// Update the time display
document.getElementById("ampm").firstChild.nodeValue = currentTimeString;
}
// -->
</script>
</head>
<body bgcolor="black" background="Wallpaper.png">
<table style="position: absolute; top: 333px; left: 0px; width: 320px; height: 461px;" cellspacing="0" cellpadding="0" align="center">
<tr align="center" valign="top" border="0" cellpadding="0">
<td height="10" valign="top">
<span id="clock">
<script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script></span><span id="ampm">
<script language="JavaScript">amPm(); setInterval('amPm()', 1000 )</script>
</span>
</td>
</tr>
<tr>
<td id="date" valign="top">
<script language="JavaScript">document.write(this_date_string)</script>
</td>
</tr>
</table>
</body>
</html>