Advertisement
Zaint

Validacion fecha?

Dec 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. int validacion_fecha(FECHA fecha1){
  2.  
  3. if(fecha1.anio<1920||fecha1.anio>2018){
  4. return 0;
  5. }else{
  6. if(fecha1.mes<1||fecha1.mes>12){
  7. return 0;
  8. }else{
  9. if(fecha1.mes==1||fecha1.mes==3||fecha1.mes==5||fecha1.mes==7||fecha1.mes==8||fecha1.mes==10||fecha1.mes==12){
  10. if(fecha1.dia<1||fecha1.dia>31){
  11. return 0;
  12. }
  13. }else{
  14. if(fecha1.mes==4||fecha1.mes==6||fecha1.mes==9||fecha1.mes==11){
  15. if(fecha1.dia<1||fecha1.dia>30){
  16. return 0;
  17. }
  18. }else{
  19. if(fecha1.anio%100==0&&fecha1.anio%400==0){
  20. if(fecha1.dia<1||fecha1.dia>29){
  21. return 0;
  22. }
  23. }else{
  24. if(fecha1.dia<1||fecha1.dia>28){
  25. return 0;
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
  32.  
  33. return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement