0

i would like to create a url based on the year and the week number in order to redirect to a document which the name changes every week : the document is stored at this place : server.com/kw38_2013.pdf (which kw38 mean week 38)

Does someone know a javascript for that ?

Regards

Emmanuel

  • Getting the year is easy with the date object http://www.w3schools.com/js/js_obj_date.asp How do you handle the week numbers though? based ont he firts mondya of the year I assume and counted from there? – Chris Morris Sep 17 '13 at 09:29

2 Answers2

1

It will be very easy to get year from a given date object in javascript. See Date Object Reference.

Whereas, Getting the week number from the given date will be tricky. Here is a similar question to get the week number from given date. See Get week of year in JavaScript.

Hope it helps.

Community
  • 1
  • 1
0

See here to get the week number. You get the year by creating a Date object : new Date().getFullYear()

Community
  • 1
  • 1
ylerjen
  • 4,109
  • 2
  • 25
  • 43