Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range

Status
Not open for further replies.

LOW

Programmer
Sep 27, 2000
45
US
I'm trying to set a date range that will return something like this: 20080101..20090101 by using the following

daterangeparm="+inmeta:DOC_DATE_NUM:" + year + "0101.." + (year+1) + "1231";

however, what is returned is: 20080101..200810101

The "1" is being added in as part of a string. How do I add "1" to the year to make 2008 become 2009?

 
This is a good shortcut to do what you want:
Code:
var year = "2008";
...
var something = year + "0101.." + (year-0+1) + "1231";
Or you can use parseInt():
Code:
var year = "2008";
...
var something = year + "0101.." + (parseInt(year,10)+1) + "1231";
Cheers,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top