Forum Home
Press F1
 
Thread ID: 38113 2003-09-27 14:01:00 Javascript problem Caesius (3758) Press F1
Post ID Timestamp Content User
178436 2003-09-27 14:01:00 I need a script that displays the time like so: 28.09.03. I have made a variation to a script I found on a site;

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
theDate= new Date();

function printDate() {
document.write(theDate);

}
// End -->
</script>

But it gives me the following: "Sun Sep 28 2003 01:05:25 GMT+1200 (New Zealand Standard Time)"

Clearly this is a bit too much, how do I change the output format of the date?

Cheers,
Ben
Caesius (3758)
178437 2003-09-27 19:47:00 I'm not too sure about Javascript,
In VB Script I imagine it would be something similar to the tune of this...

&lt;SCRIPT LANGUAGE="VBScript"&gt;
Msgbox Format(Date, "dd:mm:yy"),,"The Date"
&lt;/SCRIPT&gt;

or lets get complicated...

&lt;SCRIPT LANGUAGE="VBScript"&gt;

&lt;!-- Add a ActiveX Object in the form of a Command Button
named cmdGetDate and whatch the Fire Works! --&gt;

Public Sub cmdGetDate_Click()
Msgbox Format(Date, "dd:mm:yy"),,"The Date"
End Sub

&lt;/SCRIPT&gt;

Have no clue as to how this helps you, but it may have some carry over.
Javascript kind of sucks, but maybe that's just my bias opinion.
orewaonline.co.nz (4635)
178438 2003-09-27 21:17:00 Have a look at this page (www.w3schools.com) at W3Schools.com it should be able to help you out a tad with what you're trying to do. Also I'd have to say that JavaScript is better than VBscript, for my own biased opinions of course. -=JM=- (16)
1