function displayTime() {
var str = "";
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
if (minutes < 10) {
minutes = "0" + minutes
}
if (seconds < 10) {
seconds = "0" + seconds
}
str += hours + ":" + minutes + ":" + seconds + " ";
if(hours > 11){
str += "PM"
} else {
str += "AM"
}
return str;
}
Problem description:
I trying to make a working timestamp code for my game. I don't want the year just hours minutes seconds to appear on Worldchat before the usrs tags.
time2text(world.timeofday,"hh:mm:ss")
But you want 12 hour timestamps. Lemme just rewrite that javascript you included in your post as DM instead.
world.timeofday holds the time since midnight of the current day in deciseconds. world.realtime holds the time in deciseconds since Jan 1, 2000.