Plantilla:Hora del día
De Wikipedia, la enciclopedia libre
Esta plantilla muestra una imagen de acuerdo con la hora del día en que se visualice como primer parámetro. El segundo parámetro define el ancho de la imagen. Las imágenes están definidas de Image:Dia2.png hasta Image:Dia17.png.
11:01 UTC:
Nota: Las imágenes son meramente ilustrativas y no reflejan la realidad de manera alguna.
/** * GFDL, FML mar/2006. * * Clase rápida para generar una imagen a partir de la hora del día como parámetro. */ public class Wiki { public static void main(String[] args) { for (int i = 0; i <= 23; i++) { for (int j = 0; j <= 59; j++) { String s = "|case: " + (i<10?"0"+i:i) + ":" + (j<10?"0"+j:j) + "="; double hora = (double) i + ((double) j / 59D); int dia = 0; if (hora > 11 && hora <= 14) { dia = 2; } else if (hora > 14 && hora <= 15) { dia = 3; } else if (hora > 15 && hora <= 16) { dia = 4; } else if (hora > 16 && hora <= 16.5) { dia = 5; } else if (hora > 16.5 && hora <= 17) { dia = 6; } else if (hora > 17 && hora <= 17.5) { dia = 7; } else if (hora > 17.5 && hora <= 18) { dia = 8; } else if (hora > 18 && hora <= 18.5) { dia = 9; } else if (hora > 18.5 && hora <= 19) { dia = 10; } else if (hora > 19 && hora <= 19.5) { dia = 11; } else if (hora > 19.5 && hora <= 20) { dia = 12; } else if (hora > 20 && hora <= 20.5) { dia = 13; } else if (hora > 20.5 && hora <= 21) { dia = 14; } else if (hora > 21 && hora <= 22) { dia = 15; } else if (hora > 22 && hora <= 23) { dia = 16; } else if ((hora > 23 && hora <= 24) || hora >= 0 && hora <= 3) { dia = 17; } else if (hora > 3 && hora <= 4) { dia = 16; } else if (hora > 4 && hora <= 4.5) { dia = 15; } else if (hora > 4.5 && hora <= 5) { dia = 14; } else if (hora > 5 && hora <= 5.5) { dia = 13; } else if (hora > 5.5 && hora <= 6) { dia = 12; } else if (hora > 6 && hora <= 6.5) { dia = 11; } else if (hora > 6.5 && hora <= 7) { dia = 10; } else if (hora > 7 && hora <= 7.5) { dia = 9; } else if (hora > 7.5 && hora <= 8) { dia = 8; } else if (hora > 8 && hora <= 8.5) { dia = 7; } else if (hora > 8.5 && hora <= 9) { dia = 6; } else if (hora > 9 && hora <= 9.5) { dia = 5; } else if (hora > 9.5 && hora <= 10) { dia = 4; } else if (hora > 10 && hora <= 11) { dia = 3; } System.out.println(s + dia); } } } }