
Salud OS
Escrito 15 enero 2009 - 12:33
Escrito 15 enero 2009 - 12:38
const meses : Array [1..12] Of String = ('Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'); procedure TLector.BitBtn1Click(Sender: TObject); var dia,mes,anio,fecha : string; begin dia := '01'; mes := '01'; anio := '2009'; fecha := dia + '/' + meses[strtoint(mes)] + '/' + anio; showmessage(fecha); end;
Escrito 15 enero 2009 - 12:51
fecha := FormatDateTime('dddddd', Date); showmessage(fecha);
Escrito 15 enero 2009 - 12:56
Escrito 15 enero 2009 - 12:59
const meses : Array [1..12] Of String = ('Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'); Var Mes: Integer; begin Mes := ZCta_Mesesmes.AsInteger; //Campo de un Query ShowMessage(Meses[Mes]); end;
Escrito 15 enero 2009 - 01:02
Fecha := FormatFloat('00', Dayof(Date)) + ' de ' + meses[Monthof(Date)] + ' de ' + FormatFloat('0000', Yearof(Date));
Specifier Displays
c Displays the date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the date-time value indicates midnight precisely.
d Displays the day as a number without a leading zero (1-31).
dd Displays the day as a number with a leading zero (01-31).
ddd Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.
dddd Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.
ddddd Displays the date using the format given by the ShortDateFormat global variable.
dddddd Displays the date using the format given by the LongDateFormat global variable.
e (Windows only) Displays the year in the current period/era as a number without a leading zero (Japanese, Korean and Taiwanese locales only).
ee (Windows only) Displays the year in the current period/era as a number with a leading zero (Japanese, Korean and Taiwanese locales only).
g (Windows only) Displays the period/era as an abbreviation (Japanese and Taiwanese locales only).
gg (Windows only) Displays the period/era as a full name. (Japanese and Taiwanese locales only).
m Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mm Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mmm Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.
mmmm Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.
yy Displays the year as a two-digit number (00-99).
yyyy Displays the year as a four-digit number (0000-9999).
h Displays the hour without a leading zero (0-23).
hh Displays the hour with a leading zero (00-23).
n Displays the minute without a leading zero (0-59).
nn Displays the minute with a leading zero (00-59).
s Displays the second without a leading zero (0-59).
ss Displays the second with a leading zero (00-59).
z Displays the millisecond without a leading zero (0-999).
zzz Displays the millisecond with a leading zero (000-999).
t Displays the time using the format given by the ShortTimeFormat global variable.
tt Displays the time using the format given by the LongTimeFormat global variable.
am/pm Uses the 12-hour clock for the preceding h or hh specifier, and displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
a/p Uses the 12-hour clock for the preceding h or hh specifier, and displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.
ampm Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the TimePMString global variable for any hour after noon.
/ Displays the date separator character given by the DateSeparator global variable.
: Displays the time separator character given by the TimeSeparator global variable.
'xx'/"xx" Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.
Escrito 15 enero 2009 - 01:06
begin ShowMessage(FormatDateTime('mmm', encodedate(2009,ZCta_Mesesmes.AsInteger, 01))); ShowMessage(FormatDateTime('mmmm', encodedate(2009,ZCta_Mesesmes.AsInteger, 01))); end;
Escrito 15 enero 2009 - 01:08
Escrito 15 enero 2009 - 01:20
Escrito 15 enero 2009 - 01:20
no hombre como crees, no te llegamos ni de cerquita... jejejeYa veo que queréis hacerle la competencia a mi código inútil
Escrito 15 enero 2009 - 03:32
![]()
![]()
, pues claro, creo que mi rutina la has enviado al hilo de codigo inútil jajajaja
Salud OS
PD, era para ver si estaban atentos![]()
![]()
![]()
Escrito 15 enero 2009 - 04:00
Ya veo que queréis hacerle la competencia a mi código inútil
Escrito 15 enero 2009 - 04:02
Escrito 18 enero 2009 - 02:14
function GetFileModifyDate(FileName: string): TDateTime; var SearchRec: TSearchRec; begin Result:= 0; if FindFirst(Filename,faAnyFile,SearchRec) = 0 then begin Result:= FileDateToDateTime(SearchRec.Time); end; FindClose(SearchRec); end;
function GuardarCopia(Archivo: String): Boolean; var Ruta, Nombre: String; begin Result:= FALSE; Ruta:= 'c:\Historico\'; if ForceDirectories(Ruta) then begin Nombre:= FormatDateTime('yyyymmddhhmmss',Now) + '_' + ExtractFileName(Archivo); while FileExists(Ruta + Nombre) do begin Sleep(100); Nombre:= FormatDateTime('yyyymmddhhmmss',Now) + '_' + ExtractFileName(Archivo); end; if CopyFile(PChar(Archivo), PChar(Ruta + Nombre),TRUE) then Result:= TRUE; end; end;
procedure MostrarMensaje(Titulo,Mensaje: String); begin if Mensaje <> EmptyStr then MessageBox(0,PChar(Mensaje),PChar(Titulo), MB_OK or MB_SETFOREGROUND or MB_TASKMODAL); end;
function TempDir: String; var Buffer: Array[0..MAX_PATH] of Char; begin FillChar(Buffer,Sizeof(Buffer),#0); if GetTempPath(Sizeof(Buffer)-1,@Buffer) <> 0 then Result:= IncludeTrailingPathDelimiter(String(PChar(@Buffer))) else Result:= EmptyStr; end; function WindowsDir: String; var Buffer: Array[0..MAX_PATH] of Char; begin FillChar(Buffer,Sizeof(Buffer),#0); if GetWindowsDirectory(@Buffer,Sizeof(Buffer)-1) <> 0 then Result:= IncludeTrailingPathDelimiter(String(PChar(@Buffer))) else Result:= EmptyStr; end;
function ShortPath(Path: String): String; var Buffer: Array[0..MAX_PATH] of Char; begin FillChar(Buffer,Sizeof(Buffer),#0); if GetShortPathName(PChar(Path),@Buffer,Sizeof(Buffer)-1) <> 0 then Result:= String(PChar(@Buffer)) else Result:= EmptyStr; end;
function TamanhoFichero(FileName: String): Integer; var SearchRec: TSearchRec; begin Result:= 0; if FindFirst(Filename,faAnyFile,SearchRec) = 0 then Result:= SearchRec.Size; FindClose(SearchRec); end;
Escrito 18 enero 2009 - 02:17
Escrito 03 febrero 2009 - 05:35
function fVacio(nom: string) : boolean; begin nom := Trim(nom); if (nom = '') or (nom = null) then Result:= True else Result:= False; end;
function GetWindowsDirectory : String; var pcWindowsDirectory : PChar; dwWDSize : DWORD; begin dwWDSize := MAX_PATH + 1; GetMem( pcWindowsDirectory, dwWDSize ); try if Windows.GetWindowsDirectory( pcWindowsDirectory, dwWDSize ) <> 0 then Result := pcWindowsDirectory; finally FreeMem( pcWindowsDirectory ); end; end;
function fSepDecimal(tecla: char) : char; begin if DECIMALSEPARATOR = ',' then begin if tecla = '.' then Result:= ',' else Result := tecla; end else begin if tecla = ',' then Result:= '.' else Result := tecla; end; end;
Escrito 03 febrero 2009 - 06:17
function fPad(txt : String; l : smallint; j: string; r : string) : String; var l1, l2, len : smallint; jus,t : string; rel : char; longi : integer; begin len := l; rel := r[1]; jus := j; l1 := 0; l2 := 0; SetLength(t,len); FillChar(t[1],len,' '); if txt = null then txt := ''; if (len = null) or (len < 0) then len := 0; if jus = 'U' then txt := UpperCase(txt); if jus = 'L' then txt := LowerCase(txt); longi := Length(txt); if (len > 0) and (len <> longi) then begin if rel = null then rel := ' '; if jus = 'C' then begin //* justificación Centrada. *// l1 := len div 2; l2 := longi div 2; if longi > len then txt := copy(txt,l2,len) else begin SetLength(txt,len); FillChar(t[1],(l1-l2),rel); txt := Trim(t) + txt; longi := Length(Trim(txt)); FillChar(txt[longi+1],l2,rel); end; end; if jus = 'D' then begin //* justifico a la derecha - Ajusta a la derecha y rellena por la izquierda.*// //* Para utilizar AddChar tienes que tener instaladas las RX. Unit rxStrUtils.* // txt := AddChar(rel,txt,len); {* Sino se utiza las librerías RX, esto debería funcionar if longi > len then txt:= copy(txt,(len-longi),len) else begin SetLength(txt,len); FillChar(t[1],(len-longi),rel) ; txt := Trim(t) + txt; end;} end; if jus = 'I' then begin //* justifico a la izquierda - Ajusta a la izquierda y rellena por la derecha. *// //* Para utilizar AddChar tienes que tener instaladas las RX. Unit rxStrUtils. *// txt:= AddCharR(rel,txt,len); {Sino se utiza las librerías RX, if longi > len then txt:= copy(txt,1,len) else begin SetLength(txt,len); FillChar(txt[longi + 1],(len-longi),rel); end;} end; end; FPad := txt; end;
Escrito 03 febrero 2009 - 04:51
Consecutivo := 56; Cadena := Format('%.*d',[6,Consecutivo+1])
Escrito 06 febrero 2009 - 06:57
Escrito 09 febrero 2009 - 03:20