Jump to content

Dates


monkeytooth

Recommended Posts

Ok, don't know if this is simple or not, im not to familiar with javascript as of yet. But I need to define to variables. One being the current year. The other being the current year minus 50. then I need to print them onto the page in various locations. Anyone able to help me with that right quick?

Link to comment
Share on other sites

Is there a specific reason you need JS for this? You could generate the dates with PHP and use that to 'print them in various locations'?

 

$thisyear = date("Y");
$yearsago = date("Y", strtotime("- 50 years"));

 

If you really need to use JS you could even print the dates into the JS code..?

Link to comment
Share on other sites

I would love very much to do it in PHP however php vars don't transcribe to JavaScript vars and vise verse as far as I know. And what I wanting to do is have a date picker function that automatically adjusts the years within a certain range, so I don't have to go back in there and do it manually every so often.

 

If it were so easy I would have been very happy :-D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.