I'm trying to code a count up that show how many MONDAYS we had from a specific date.

For example since 10/01/2012 we had 4 mondays until today October 25.

This first step I could achieve with some coding searching from some places and adapting it to my needs.

Now the tricky part for me is to make a way to show a count up that shows a percentage of how much from now to the next month is remaining to increase another monday to the main counter.

For example, from 10/01/2012 we had 4 mondays until now, but October 25 is Thursday so how could I do a count up that shows the time increasing with the value that is remaining to achieve next monday?

I tried to put as a count up like using days, hours, minutes and seconds so everytime it runs it starts from today with the value counting up to the next monday so week by week we would have a number like this in the counter: 6days 23hours 59minutes 59seconds and then add a new number to the number of mondays so we achieved a new monday after the 6 days, but of course if I visit the page running the code in the middle I will already have the counter with the value added on it and counting each second live.

Could someone help? If you know a better way to achieve the same goal it is perfectly ok.

To summarize what I want to achieve is a counter that says how many mondays have passed and how much time is left to the next monday and counting up live. It has to keep going for ever not to stop on the next monday, after achieving the following monday it keeps going until the next.

Questions are welcome!

```<pre><code>

// This Code Counts how many mondays from a specified date to the actual date.
// Create a new date variable
var d = new Date();
var month = d.getMonth() + 1;
var day = d.getDate();

// Get the actual date and store on a variable
var actualDate = d.getFullYear() + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;

// Set dates start and get actual date
var date1 = new Date('10/01/2012'); // Set the begninning date here
var date2 = new Date(actualDate);

var monday = Math.abs(date1.getTime() - date2.getTime()) / (1000 * 60 * 60 * 24 * 7);
monday -= 0.1;
monday = Math.floor(monday);
monday *= 1;

if (date1.getDay() == 1) monday += 1;
if (date2.getDay() == 1) monday += 1;

//\$('').html(monday);
\$("#showMondays").text(monday);

</pre></code>
```

This is the working monday counter: http://jsfiddle.net/hRaAF/

Thank you!

Aug 11, 2022 548 views

## Jquery Countdown timer display only hours minutes and seconds calculated from date

I want to show just the hours ...READ MORE

## When I delete data from jquery data-table it still showing in grid until refresh

I tried that table automatically refresh but ...READ MORE

## jQuery UI DatePicker - Change Date Format

I am using the UI DatePicker from ...READ MORE

## jQuery \$(this) selector function and limitations

this isn't a jQuery "thing", but a basic JavaScript ...READ MORE

## Using Jquery Ajax to retrieve data from Mysql

Perform a AJAX GET request to get ...READ MORE

## How can I make a PHP counter?

I did this in Javascript but when ...READ MORE

## jQuery counter to count up to a target number

Use the jQuery animate function to count ...READ MORE