Re: Addition in data using javascript...

Wednesday, October 17, 2012

// These functions work on local time.
// For UTC, use getUTCDate, setUTCDate,
//   getUTCMonth, getUTCFullYear instead.

// Add numDays to date d returning
// a new date object.

function addDays(d, numDays) {
    var nd = new Date(d);
    nd.setDate(nd.getDate() + numDays);
    return nd;

// convert date object d to dd/mm/yyyy format.

function ddmmyyyy (d) {
    return d.getDate()+"/"+(d.getMonth()+1)+"/"+d.getFullYear();

// Put it all together:
var s;
s = ddmmyyyy(addDays(new Date, 7));
// s contains a date 7 days hence in dd/mm/yyyy format.

If you like, you can test the above SNIPPET in my
JavaScript Calculator page located here:
Simply copy and paste everything from BEGIN SNIPPET to
END SNIPPET into the TEXTAREA of the JavaScript Calculator.  

NOTE TO MODERATOR: The above is NOT a phishing lure.
I invite you to open the page source and see for yourself.
I use it to test my JavaScript receipts all the time.

James Larson
In God We Trust...

On Wednesday, September 5, 2012 9:39:29 AM UTC-4, Ali Ahmed wrote:
Hi i want to add 7 days in date and date should be show in dd/mm/yyyy format...



Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii