Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <!-- problema 30 -->
  2. <!doctype html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Titulo</title>
  6. <script type="text/javascript" >
  7. var fecha=prompt("Give a date dd mm yyyy:");
  8. var getday,getmonth,getyear,space;
  9. var posday=fecha.indexOf(' ');
  10. getday=fecha.substring(0,posday);
  11. var posmon=fecha.indexOf(' ',posday+1);
  12. getmonth=fecha.substring(posday+1,posmon);
  13. getyear=fecha.substring(posmon+1);
  14. //document.write("day is"+getday);
  15. var dateAct = new Date();
  16. var dayAct=dateAct.getDate();
  17. var MonAct=dateAct.getMonth()+1;
  18. if(getday==dayAct && getmonth==MonAct){
  19. document.write("Feliz cumpleAño feliz!!!!");
  20. }else{
  21. document.write("Today is not your birthday");
  22. date=new Date(getyear,getmonth-1,getday);
  23. var diff=dateAct-date;
  24. diff=Math.floor(diff/(1000*24*60*60));
  25. document.write("<br>You have Days: "+diff);
  26. var Fy=Math.floor(diff/365);
  27. var resta=(diff%365);
  28. var Fm=Math.floor(resta/30);
  29. var Fd=Math.floor(resta%30);
  30. document.write("<br>You have year: "+Fy);
  31. document.write("<br>You have months: "+Fm);
  32. document.write("<br>You have Days: "+Fd);
  33. }
  34. </script>
  35. </head>
  36. <body>
  37. <h1>Hola</h1>
  38.  
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement