Date converter

 

Certainly, here's the HTML code block for the date converter: ```html Date Converter

<script>

function bs_to_ad(year, month, day) {

  var bs_offset = 56.7;

  var ad_year = parseInt(year) + bs_offset;

  return [parseInt(ad_year), parseInt(month), parseInt(day)];

}

function ad_to_bs(year, month, day) {

  var bs_offset = 56.7;

  var bs_year = parseInt(year) - bs_offset;

  return [parseInt(bs_year), parseInt(month), parseInt(day)];

}

// Example usage:

var bs_year = 2078, bs_month = 9, bs_day = 5;  // Sample BS date

var ad_date = bs_to_ad(bs_year, bs_month, bs_day);

console.log("BS: " + bs_year + "/" + bs_month + "/" + bs_day + "  -->  AD: " + ad_date.join("/"));

var ad_year = 2024, ad_month = 1, ad_day = 20;  // Sample AD date

var bs_date = ad_to_bs(ad_year, ad_month, ad_day);

console.log("AD: " + ad_year + "/" + ad_month + "/" + ad_day + "  -->  BS: " + bs_date.join("/"));

</script>

``` You can copy and paste this code block directly into a blogspot post. Adjust the sample dates as needed.

0 Comments