My requirement is to When ever the user click on a year it should should the the selected year value sales as Current year sales and previous year of the that selected year should be previuos year sales. Peter, your page needs to be saved as a PHP i.e. Syntax Likewise for Jan-Sep 2015. Syntax: date( … Writing and maintaining these long list of options/years can be very monotonous via plain HTML. Schools of Web is run by web developer and designer to help others learn it easily. It does not return the year using the default calendar of the current culture. Accept Solution Reject Solution. Add a Solution. The end result should look like this: In what year were you born? If a user selects 2017 on the slicer then it should display 2017 sales as CY Sales and 2016 Sales as PY Sales. Thanks in Advance. Writing and maintaining these long list of options/years can be very monotonous via plain HTML. would generate last day from last month this year. Definition and Usage. Topic: JavaScript / jQuery Prev|Next. Hope this might help you. v3. One should compare the same number of months in the previous year Jan-Sep 16. Posted 19-May-11 22:33pm. This time is measured as a number of seconds since Jan 1, 1970. It displays the current and next year correctly except last year, which gives me "1970". The YEAR() function returns the year part for a given date (a number from 1000 to 9999). Im trying to display a list of years (last year, current year and next year) with these simple code i made.. Getting yesterday and previous days date values You must have seen how to get today date by using date function.By changing the date value we can get the dates of yesterday. The better way is to ask the visitors to select month, date and year from a drop down list box. How to load dropdownlist, currentyear, previous year and next two years. The following example code will be very useful if you want to put a copyright notice in a website footer without worrying about changing it every year. Example like below. You can use any one of the following method- Method 1: Using date () function Use the format character “Y” (Capital letter) in the date () function to display the current year. each » « count . To display current year is very easy and simple in PHP. Use format() method to format the date object and returns the current year. Please Help me. How to get current year in PHP ? It would be wrong to compare Nov2015 to Sep 2016 which would be 11 months. Same way we can extend this to get date values of last 7 days. This following codebyte generates a simple select box, with an