Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- problema 30 -->
- <!doctype html>
- <head>
- <meta charset="utf-8">
- <title>Titulo</title>
- <script type="text/javascript" >
- var fecha=prompt("Give a date dd mm yyyy:");
- var getday,getmonth,getyear,space;
- var posday=fecha.indexOf(' ');
- getday=fecha.substring(0,posday);
- var posmon=fecha.indexOf(' ',posday+1);
- getmonth=fecha.substring(posday+1,posmon);
- getyear=fecha.substring(posmon+1);
- //document.write("day is"+getday);
- var dateAct = new Date();
- var dayAct=dateAct.getDate();
- var MonAct=dateAct.getMonth()+1;
- if(getday==dayAct && getmonth==MonAct){
- document.write("Feliz cumpleAño feliz!!!!");
- }else{
- document.write("Today is not your birthday");
- date=new Date(getyear,getmonth-1,getday);
- var diff=dateAct-date;
- diff=Math.floor(diff/(1000*24*60*60));
- document.write("<br>You have Days: "+diff);
- var Fy=Math.floor(diff/365);
- var resta=(diff%365);
- var Fm=Math.floor(resta/30);
- var Fd=Math.floor(resta%30);
- document.write("<br>You have year: "+Fy);
- document.write("<br>You have months: "+Fm);
- document.write("<br>You have Days: "+Fd);
- }
- </script>
- </head>
- <body>
- <h1>Hola</h1>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement