[AS2.0]- Linux Clock

Has anyone ever made a clock for linux?? I found a tutorial for windows, but it doesn’t work on my linux system.

This is what i found for windows-

time = new Date();
var seconds = time.getSeconds()
var miniutes = time.getMinutes()
var hours = time.getHours()
if (hours<12){
 ampm = "AM";
}
else{
 ampm = "PM";
}
while (hours > 12){
 hours = hours - 12;
}
if (hours < 10){
 hours = "0" +hours;
}
if (miniutes <10){
 miniutes = "0" +miniutes;
}
if (seconds < 10){
 seconds = "0" +seconds;
}
txt_clock.text = hours +":" +miniutes +":" +seconds +" " +ampm;

Can anyone help me, or point me to a book or tutorial?