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
https://forums.phpfreaks.com/topic/182119-dates/
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
https://forums.phpfreaks.com/topic/182119-dates/#findComment-960840
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
https://forums.phpfreaks.com/topic/182119-dates/#findComment-961018
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.