How do I get what the Friday (day name ) 2 weeks from the present date

BobbyJones

I really need your help with this,

What I would like to accomplish is being able to return the date value ( the day name ) after two weeks starting from today, in this example it's gonna be Friday.

var present_date = Thursday, November 23, 2017

var result_date =  Friday, December 8, 2017 // after two weeks

function present_date_plus_2weeks() {

    var now = new Date()

    now.setDate(now.getDate()+14)

    alert(now)

}

It gets the date 2 weeks from the present date, but I need the code to get the Friday (the day name)

Impossible to do?

Taki

Based on your code and what i understand from it:

var present_date = new Date();

var days = ['Monday', 'tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];

function present_date_plus_2weeks() {

    var now = new Date()

    now.setDate(now.getDate()+14)

    var numDay = now.getDay(); 
    alert(days[numDay]);

}

present_date_plus_2weeks();

However, i would recommend using momentjs

with that you can simply do :

var afterTwoWeeks = new moment().add(14, 'days').format('dddd');

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I add 2 weeks to a Date in java?

From Dev

How to get the values present within 4 weeks / 28 days from the existing date in SQL Server

From Dev

How to get name of the day from date with momentjs

From Dev

How can I get 'day of week' for the 'Friday' only?

From Dev

Get list of weeks that start on a Friday

From Dev

In excel 2010 how do I change the cell colour to red if the date entered is 2 weeks or more in the past?

From Java

How do I get the day of week given a date?

From Dev

How do I get the day name into a cell in Excel?

From Dev

Sql how to get from 5 weeks startdate and end date

From Dev

How to get day (2-digit) from date string

From Dev

How to get a day of month from "what I know"?

From Dev

How to take a date from day name?

From Dev

I want to get all the weeks in a year with the start and end working day date for each week in java starting at current date?

From Dev

Django get weeks from model date to today

From Dev

How do I present a UIViewController from SKScene?

From Dev

Get the date of Sunday and Saturday 2 weeks ago

From Dev

Get date from day/month/year and then get the name of the day (from generated date)

From Dev

Get date from day/month/year and then get the name of the day (from generated date)

From Dev

How to get day of week name from selected date month and year in Android?

From Dev

how to add days / weeks from separate field in start date to get end date in datepicker?

From Dev

How to get date from day of year

From Dev

How to fill in weeks from date in spreadsheet?

From Dev

how to get number of day (as in year) from a date in php example if it date is 20/2/1998 ans will be 51.?

From Java

Moment.js get day name from date

From Dev

Get name of day from date (dd-mm-yyyy)

From Dev

get three-letter day name from date command

From Dev

How do I get a list of users not present in a CSV file from /etc/passwd?

From Dev

How do I get all values present in one table, but only some from another table

From Dev

How do I draw a horizontal line from the third friday close of every month in Pinescript?

Related Related

  1. 1

    How do I add 2 weeks to a Date in java?

  2. 2

    How to get the values present within 4 weeks / 28 days from the existing date in SQL Server

  3. 3

    How to get name of the day from date with momentjs

  4. 4

    How can I get 'day of week' for the 'Friday' only?

  5. 5

    Get list of weeks that start on a Friday

  6. 6

    In excel 2010 how do I change the cell colour to red if the date entered is 2 weeks or more in the past?

  7. 7

    How do I get the day of week given a date?

  8. 8

    How do I get the day name into a cell in Excel?

  9. 9

    Sql how to get from 5 weeks startdate and end date

  10. 10

    How to get day (2-digit) from date string

  11. 11

    How to get a day of month from "what I know"?

  12. 12

    How to take a date from day name?

  13. 13

    I want to get all the weeks in a year with the start and end working day date for each week in java starting at current date?

  14. 14

    Django get weeks from model date to today

  15. 15

    How do I present a UIViewController from SKScene?

  16. 16

    Get the date of Sunday and Saturday 2 weeks ago

  17. 17

    Get date from day/month/year and then get the name of the day (from generated date)

  18. 18

    Get date from day/month/year and then get the name of the day (from generated date)

  19. 19

    How to get day of week name from selected date month and year in Android?

  20. 20

    how to add days / weeks from separate field in start date to get end date in datepicker?

  21. 21

    How to get date from day of year

  22. 22

    How to fill in weeks from date in spreadsheet?

  23. 23

    how to get number of day (as in year) from a date in php example if it date is 20/2/1998 ans will be 51.?

  24. 24

    Moment.js get day name from date

  25. 25

    Get name of day from date (dd-mm-yyyy)

  26. 26

    get three-letter day name from date command

  27. 27

    How do I get a list of users not present in a CSV file from /etc/passwd?

  28. 28

    How do I get all values present in one table, but only some from another table

  29. 29

    How do I draw a horizontal line from the third friday close of every month in Pinescript?

HotTag

Archive