Template:IxTimeConvert

From IxWiki
Revision as of 19:25, 3 August 2024 by Heku (talk | contribs) (Created page with "<span id="ix-time-convert-{{#time:U}}">Loading...</span> <script> (function() { function convertToIxTime(year, month, day) { var epoch = new Date(2020, 9, 4).getTime() / 1000; var inputDate = new Date(year, month - 1, day).getTime() / 1000; var secondsSinceEpoch = inputDate - epoch; var ixTime = Math.floor(secondsSinceEpoch * 4.0 + epoch); var ixDate = new Date(ixTime * 1000); var options = { weekday: "long", year: "numeric", m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Loading... <script> (function() {

 function convertToIxTime(year, month, day) {
   var epoch = new Date(2020, 9, 4).getTime() / 1000;
   var inputDate = new Date(year, month - 1, day).getTime() / 1000;
   var secondsSinceEpoch = inputDate - epoch;
   var ixTime = Math.floor(secondsSinceEpoch * 4.0 + epoch);
   var ixDate = new Date(ixTime * 1000);
   var options = {
     weekday: "long",
     year: "numeric",
     month: "long",
     day: "numeric",
     hour: "2-digit",
     minute: "2-digit",
     second: "2-digit",
     timeZoneName: "short",
   };
   return ixDate.toLocaleString("en-US", options);
 }
 var params = "Template:1|Template:2|Template:3".split('|');
 var year = parseInt(params[0]) || new Date().getFullYear();
 var month = parseInt(params[1]) || (new Date().getMonth() + 1);
 var day = parseInt(params[2]) || new Date().getDate();
 var result = convertToIxTime(year, month, day);
 document.getElementById("ix-time-convert-1732592504").textContent = result;

})(); </script>