From 732a0632295a5e7e2cb0ad1ff65e35c3717c912e Mon Sep 17 00:00:00 2001 From: 20xd6 <20xd6@airmail.cc> Date: Sun, 9 May 2021 12:28:02 -0400 Subject: [PATCH] Add Copy Timestamp A button that will copy the current timestamp has been added. --- clock.js | 11 +++++++++++ clock.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/clock.js b/clock.js index 875acf5..b58802c 100644 --- a/clock.js +++ b/clock.js @@ -46,3 +46,14 @@ function startTime(){ } //document.getElementById('JStz').innerHTML = current_tz; } + +function copy_timestamp() { + var copyText = document.getElementById("time_body").innerText; + var temp_element = document.createElement("textarea"); + document.body.appendChild(temp_element) + temp_element.value = copyText; + temp_element.select(); + temp_element.setSelectionRange(0,999); + document.execCommand("copy"); + document.body.removeChild(temp_element); +} diff --git a/clock.php b/clock.php index 6ae0eb7..2420058 100644 --- a/clock.php +++ b/clock.php @@ -45,7 +45,7 @@ "
". "

". date("D, M d, Y, H:i:s") . - "

GMT". date("O T") ."

\n\t\t
"; + "

GMT". date("O T") ."

\n\t\t"; if($_POST['originalTZ']){// if the user want display the browser detected timezone as well as the selected one. date_default_timezone_set($originalTZ); echo'

Time in original Timezone

'.