Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-08-2016
Avatar de TOPX
TOPX TOPX is offline
Miembro
 
Registrado: may 2008
Ubicación: Bogotá
Posts: 527
Poder: 19
TOPX Va camino a la fama
Un programa básico para guiarse:
Label1 tiene la hora actual
Edit1 tiene la hora a restar
Label2 tiene horas, minutos y segundos resultantes
Código Delphi [-]
unit Unit1;

interface

uses
  Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  dif: Extended;
begin
  dif := Time() - StrToTime(Edit1.Text);
  Label2.Caption := FormatDatetime('hh:nn:ss', dif);

  if dif < 0 then
  begin
    Label2.Caption := '- ' + Label2.Caption;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption := TimeToStr(Time()) + ' menos ';
end;

end.
Código Delphi [-]
object Form1: TForm1
  ClientHeight = 243
  ClientWidth = 527
  object Label1: TLabel
    Left = 56
    Top = 88
    Width = 31
    Height = 13
    Caption = 'Label1'
  end
  object Label2: TLabel
    Left = 384
    Top = 88
    Width = 31
    Height = 13
    Caption = 'Label2'
  end
  object Edit1: TEdit
    Left = 144
    Top = 85
    Width = 121
    Height = 21
    TabOrder = 0
    Text = '11:11:10'
  end
  object Button1: TButton
    Left = 288
    Top = 83
    Width = 75
    Height = 25
    Caption = '='
    TabOrder = 1
    OnClick = Button1Click
  end
  object Timer1: TTimer
    OnTimer = Timer1Timer
    Left = 256
    Top = 128
  end
end
-
__________________
"constructive mind, destructive thoughts"
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
calculo de diferencia entre dos horas y minutos gonza_619 Varios 1 22-05-2010 20:35:31
Cantidad de Minutos entre 2 Horas con el DateTimePicker ANDRES86 OOP 11 02-07-2007 23:11:19
MinuteSpan... minutos entre horas mjjj Varios 1 25-06-2007 17:28:59
Funcion para pasar de minutos a horas Asshole Varios 1 13-06-2005 13:23:27
Calcular Horas y minutos entre dos TTime Delphos Varios 4 26-01-2004 17:10:14


La franja horaria es GMT +2. Ahora son las 01:31:48.


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