www.webdeveloper.com
Results 1 to 5 of 5

Thread: age in seconds calculator?

  1. #1
    Join Date
    Jul 2009
    Posts
    2

    age in seconds calculator?

    hello everyone!!

    i have a website and would like to have a "your age in seconds" calculator, and a "your weight in bags of sugar" calculator.
    Thing is, i know nothing about programming javascript, in fact, it was a freind of mine who reccomended this site as he`d had assistance here before.
    Can anyone help? or is there some kind of script already out there that i can use?

    Thanks

    Steve

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    Fon age in years to age in seconds (x in years, y in seconds)
    y=x * 365*24*3600

    Taking count of the number of leap years (n in days)
    n=parseInt(x/4);

    We end up with
    y=parseInt(x*365.25*24*3600)

    I hope this point you in the right direction?

  3. #3
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    Of course to be more exact you have to take into account the birthdate substracted from the current date

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,278
    Age in seconds:
    Code:
    (new Date() - new Date ('1 Jan 1970')) * 100
    And the date string can be in several, platform dependent formats.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Jul 2009
    Posts
    2
    thanks for the replies, i have noted them down and will have a read up on how to actually put this code into a webpage.

    cheers!!

    steve

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles