Page 1 of 1

Date on the mac

Posted: September 18th, 2008, 3:45 pm
by cdinic
I'm trying to time stamp my errorLog.txt

In the scripting guide there is this example for alerting the current system time:

var timeSrt = system.callSystem("cmd.exe /c \"time/t\"");
alert("Current time is " + timeStr);

How can I accomplish this on the Mac/osx?

In terminal, the command is "date" but I cant' find the method for executing a command in Terminal.

Thanks!
-C

Re: Date on the mac

Posted: September 19th, 2008, 5:40 am
by Paul Tuersley
How about using the javascript date object? Just google "javascript date" for reference.

Code: Select all

theDate = new Date();
alert(theDate);
hours = theDate.getHours();
alert(hours);

Re: Date on the mac

Posted: September 19th, 2008, 1:27 pm
by cdinic
nice! I was thinking to hard.

Thanks,
-C