Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2003
    Location
    Bloomsbury, London
    Posts
    102
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Show last year please?

    How can I display the last year please? i.e. 2004 when the year is 2005 or 2006 when the year is 2007?

    Had no luck finding a code in Google.

    Thank you.
    Domain Exhibit - premium domain names and websites with significant traffic | quote Coding Forums for additional 15% discount!
    Coding Freebies - free scripts and software worth hundreds of dollars

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try: getFullYear()-1
    Last edited by Willy Duitt; 07-02-2005 at 12:18 AM.

  • #3
    New Coder
    Join Date
    May 2005
    Location
    Alabama
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    something like:

    Code:
    function getLastYear(){
    var today = new Date();
    var lastYear = today.getFullYear() -1;
    
    return lastYear;
    }
    You can change the "return" for a "document.write" or "alert()" or whatever code you want

  • #4
    Regular Coder
    Join Date
    Nov 2003
    Location
    Bloomsbury, London
    Posts
    102
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you very much
    Domain Exhibit - premium domain names and websites with significant traffic | quote Coding Forums for additional 15% discount!
    Coding Freebies - free scripts and software worth hundreds of dollars


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •