Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Conexión con bases de datos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Conexión con bases de datos

 
 
Herramientas Buscar en Tema Desplegado
  #8  
Antiguo 22-12-2005
ronalg ronalg is offline
Miembro
 
Registrado: may 2003
Ubicación: Sucre - Bolivia
Posts: 68
Poder: 24
ronalg Va por buen camino
Lo siento supuse

Supongo que para meter datos al campo del tipo DATE haces algo asi:

Código Delphi [-]
table.insert;
table.fieldbyname('hora').value:=Now;
o
table.fieldbyname('hora').value:=date();
o
table.fieldbyname('hora').value:=today();
o
table.fieldbyname('hora').value:=time;
o
//si estas usando un componente calendario
table.fieldbyname('hora').value:=calendario.date;
.
.
.
.
.
table.post

todos estos (now, date(), today(), time) contiene valores del tipo TDateTime que esta definido asi:

Código Delphi [-]
type TDateTime = type Double;

Cita:
Description

Most VCL objects represent date and time values using the TDateTime type. The integral part of a TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of a TDateTime value is fraction of a 24 hour day that has elapsed.

Following are some examples of TDateTime values and their corresponding dates and times:

0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values, unless one of the TDateTime values is negative. Similarly, to increment a date and time value by a certain fractional number of days, add the fractional number to the date and time value if the TDateTime value is positive.
When working with negative TDateTime values, computations must handle time portion separately. The fractional part reflects the fraction of a 24-hour day without regard to the sign of the TDateTime value. For example, 6:00 am on 12/29/1899 is –1.25, not –1 + 0.25, which would be –0.75. There are no TDateTime values between –1 and 0.
osea que contiene si o si la fecha y la hora siempre.

para sacar solo la hora sin la fecha debes hacer uso de DATEOF y para sacar solo la hora de TIMEOF, estas funciones estan en la unidad "DateUtils" que debes ponerla a mano en el USES de tu unidad.

Código Delphi [-]
table.insert;
table.fieldbyname('hora').value:=timeof(Now);
o
table.fieldbyname('hora').value:=timeof(date());
o
table.fieldbyname('hora').value:=timeof(today());
o
table.fieldbyname('hora').value:=timeof(time);
.
.
.
.
table.post

Esto extraera solo la hora.

espero te sirva
__________________
Saludos desde Sucre - Bolivia
"Si te lo puedes imaginar lo
puedes resolver" Pyriel

Última edición por ronalg fecha: 22-12-2005 a las 01:17:03.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 04:57:07.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi