Ver la Versión Completa : ¿Existen funciones en Delphi que retornen el día y la hora?
Estoy tratando de dar con ello pero no lo encuentro, ¿se puede hacer esto?
Gracias.
Kipow
18-12-2008, 22:44:18
De la ayuda de Delphi. :)
Function NOW();
Returns the current date and time.
Pascal
function Now: TDateTime;
C++
TDateTime Now();
http://www.clubdelphi.com/foros/btn_collapse_large.gifFile
SysUtils
http://www.clubdelphi.com/foros/btn_collapse_large.gifDescription
Returns the current date and time, corresponding to the sum of the value
returned by the global Date (http://www.clubdelphi.com/foros/SysUtils_Date.html) and Time (http://www.clubdelphi.com/foros/SysUtils_Time.html) functions.
Note: Although TDateTime values can represent milliseconds, Now is
accurate only to the nearest second.
Hola noob, para obtener el día y la hora existen varias funciones, con Now como te han indicado obtienes la fecha y hora actual. Una forma podría ser utilizar las funciones DayOf y TimeOf o también puedes utilizar el procedimiento DecodeDateTime al cual le pasas una fecha y las variables donde quieres que te devuelva la fecha y hora desagregada.
Showmessage('Dia: '+IntToStr(DayOf(Now))+' Hora:'+TimeToStr(TimeOf(Now)));
//Donde Anio, Mes, Dia, Hora, minuto, segundo, milisegundo son variables de tipo Word
DecodeDateTime(Now, Anio, Mes, Dia, Hora, minuto, segundo, milisegundo);
Saluditos
vBulletin v3.6.8, Derechos ©2000-2024, Jelsoft Enterprises Ltd.