La Web del Programador: Comunidad de Programadores
 
    Pregunta:  63545 - LEER FECHA DE LA BIOS CON TURBO PASCAL
Autor:  r. b.
Hola, alguien sabe como se puede leer la fecha y la hora desde la bios?. Necesito hacer una agenda y necesito esos datos. Desde ya gracias.

  Respuesta:  ramon garcia
program fechahora;

uses
crt, Dos;
const
days : array [0..6] of String[9] =
('domingo','lunes','martes',
'mi‚rcoles','jueves','viernes',
'S bado');
var
h, m, s, hund : Word; { Para GetTime}
y, ms, d, dow : Word; { para Getdate}

function colocozero(w : Word) : String;
var
s : String;
begin
Str(w:0,s);
if Length(s) = 1 then
s := '0' + s;
colocozero := s;
end;

begin
clrscr;
GetTime(h,m,s,hund);
GetDate(y,ms,d,dow);
textcolor(14);
gotoxy(13,11);write('Hora / Minuto / Segundo');
textcolor(10);
gotoxy(13,13);write(colocozero(h),' / ',colocozero(m),' / ',colocozero(s));
textcolor(14);
gotoxy(13,15);write('Hoy es / Dia / Mes / A¤o');
textcolor(10);
gotoxy(13,17);write(days[dow],' / ',d:0,' / ',ms:0,' / ',y:0);
textcolor(0);
readln;
end.