Calculating year from total minutes while accounting for leap year

I'm putting together an ICS file generator using jquery. After inputting the Date and time zone I figured it would be easiest to calculate out total minutes then make the timezone conversion to Z-time / UTC-0 / GMT and reconvert the total time into each appropriate time unit (year, month, date, hour and minute).

I'm putting together an ICS file generator using jquery. After inputting the Date and time zone I figured it would be easiest to calculate out total minutes then make the timezone conversion to Z-time / UTC-0 / GMT and reconvert the total time into each appropriate time unit (year, month, date, hour and minute).

My question concerns the logic of my function: is this the most effective way to do this calculation, 2018 checks? Keep in mind, every leap year (current year is divisible by 4) has 527040 minutes and the common year (not divisible by 4) has 525600.

var timeTot = 1061911800; // for debug
var uyear = 1; // DODGE DIVIDE BY ZERO ERROR

while (timeTot >= 525600 || timeTot >= 527040) {
if (uyear % 4 != 0) { // is common year?
timeTot -= 525600;
uyear++;
} else if (uyear % 4 == 0) { // is leap year?
timeTot -= 527040;
uyear++;
} else {
//infinite loop!
timeTot = 0;
}
}
uyear -= 1; // UNDODGE DIVIDE BY ZERO
// uyear is 2018 ( 1/1/[email protected]:00 UTC-6 )


jQuery ajax get request method example

jQuery ajax get request method example

### jQuery Ajax Get Request Method Example This article is originally published at [https://www.tutsmake.com/jquery-api-ajax-get-method-example/](https://www.tutsmake.com/jquery-api-ajax-get-method-example/...

jQuery Ajax Get Request Method Example

This article is originally published at https://www.tutsmake.com/jquery-api-ajax-get-method-example/

Let's see example of jquery ajax get request.

<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Ajax GET Request Example</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> 
<style>  
.formClass
{
    padding: 15px;
    border: 12px solid #23384E;
    background: #28BAA2;
    margin-top: 10px;
} 
</style> 
<script type="text/javascript">
$(document).ready(function(){
   $("button").click(function(event){
 
    var name = "Tutsmake";
     
    $.get('https://www.tutsmake.com/Demos/html/ajax-get-method.php', {webname: name}, function(data){
 
        $("#output").html(data);
    });
 
  });
 
});
</script>
</head>
<body>
    <div class="formClass">
      <button type="button">Click &amp; Get Data</button><br>
      <div id="output">Hello</div>    
    </div>
</body>
</html>   ```                         

This article is originally published at [https://www.tutsmake.com/jquery-api-ajax-get-method-example/](https://www.tutsmake.com/jquery-api-ajax-get-method-example/ "https://www.tutsmake.com/jquery-api-ajax-get-method-example/")

jQuery Full Course - jQuery Tutorial From Beginner to Advanced - Learn jQuery 2019

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. In this video, you'll learn jQuery from Beginner to Advanced

jQuery is open-source software using the permissive MIT License. Web analysis indicates that it is the most widely deployed JavaScript library by a large margin.

Mastering jQuery will boost up your career specially in web development. This course is designed you to master yourself in jQuery through step by step process.

Course Contents

  • jQuery Intro
  • What is jQuery and what you will learn?
  • Downloading jQuery
  • jQuery Basics
  • A first look at jQuery code
  • Selectors and Filters
  • Replacing contents
  • Handling events
  • Hide/Show events
  • Fading
  • Slide
  • Toggle
  • Animate
  • Selectors
  • Filters
  • jQuery Advanced
  • Advanced Selectors
  • Creating Content
  • Creating Content: Part 2
  • Inserting content
  • Modifying content
  • Modifying CSS
  • Final thoughts


What you’ll learn

  • Will become Master in client side web development
  • Will become expert in jQuery
  • Will earn working experience on jQuery
  • Are there any course requirements or prerequisites?
  • Prior experience on HTML and CSS required.
  • Who this course is for:
  • Who wanna expert in client side web development
  • Who wanna expert in jQuery


Thanks for watching

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

jQuery Crash Course: jQuery Tutorial Step by Step

jQuery Crash Course: jQuery Tutorial Step by Step

jQuery Crash Course: jQuery Tutorial Step by Step