Posteado por: alejandrolaorden | 18 marzo, 2007

Componente librerías imprescindibles Delphi

Hola!

He encontrado un componente que ahorra muchísimos dolores de cabeza, muchísimas horas enfrente del ordenador escribiendo código que ya está hecho por gente muy altruísta que ha querido compartir sus horas de trabajo con nosotros.

Tiene funciones de cálculo, extracción de fechas, String, Hash, MD5, SHA1.

http://sourceforge.net/projects/fundementals/

Dejo las cabeceras de las funciones de fecha para que veáis un resumen.

procedure DecodeDateTime(const DateTime: TDateTime;
var Year, Month, Day, Hour, Minute, Second, Millisecond: Word);
{$ENDIF}
function Century(const D: TDateTime): Word;
function Year(const D: TDateTime): Word;
function Month(const D: TDateTime): Word;
function Day(const D: TDateTime): Word;
function Hour(const D: TDateTime): Word;
function Minute(const D: TDateTime): Word;
function Second(const D: TDateTime): Word;
function Millisecond(const D: TDateTime): Word;

const
OneDay = 1.0;
OneWeek = OneDay * 7;
OneHour = OneDay / 24.0;
OneMinute = OneHour / 60.0;
OneSecond = OneMinute / 60.0;
OneMillisecond = OneSecond / 1000.0;

{ }
{ Encoding }
{ }
{$IFNDEF DELPHI6_UP}
function EncodeDateTime(const Year, Month, Day, Hour, Minute, Second, Millisecond: Word): TDateTime;
{$ENDIF}
procedure SetYear(var D: TDateTime; const Year: Word);
procedure SetMonth(var D: TDateTime; const Month: Word);
procedure SetDay(var D: TDateTime; const Day: Word);
procedure SetHour(var D: TDateTime; const Hour: Word);
procedure SetMinute(var D: TDateTime; const Minute: Word);
procedure SetSecond(var D: TDateTime; const Second: Word);
procedure SetMillisecond(var D: TDateTime; const Milliseconds: Word);

{ }
{ Comparison }
{ }
function IsEqual(const D1, D2: TDateTime): Boolean; overload;
function IsEqual(const D1: TDateTime; const Ye, Mo, Da: Word): Boolean; overload;
function IsEqual(const D1: TDateTime; const Ho, Mi, Se, ms: Word): Boolean; overload;
function IsAM(const D: TDateTime): Boolean;
function IsPM(const D: TDateTime): Boolean;
function IsMidnight(const D: TDateTime): Boolean;
function IsNoon(const D: TDateTime): Boolean;
function IsSunday(const D: TDateTime): Boolean;
function IsMonday(const D: TDateTime): Boolean;
function IsTuesday(const D: TDateTime): Boolean;
function IsWedneday(const D: TDateTime): Boolean;
function IsThursday(const D: TDateTime): Boolean;
function IsFriday(const D: TDateTime): Boolean;
function IsSaturday(const D: TDateTime): Boolean;
function IsWeekend(const D: TDateTime): Boolean;

{ }
{ Relative date/times }
{ }
function Noon(const D: TDateTime): TDateTime;
function Midnight(const D: TDateTime): TDateTime;
function FirstDayOfMonth(const D: TDateTime): TDateTime;
function LastDayOfMonth(const D: TDateTime): TDateTime;
function NextWorkday(const D: TDateTime): TDateTime;
function PreviousWorkday(const D: TDateTime): TDateTime;
function FirstDayOfYear(const D: TDateTime): TDateTime;
function LastDayOfYear(const D: TDateTime): TDateTime;
function EasterSunday(const Year: Word): TDateTime;
function GoodFriday(const Year: Word): TDateTime;

function AddMilliseconds(const D: TDateTime; const N: Int64): TDateTime;
function AddSeconds(const D: TDateTime; const N: Int64): TDateTime;
function AddMinutes(const D: TDateTime; const N: Integer): TDateTime;
function AddHours(const D: TDateTime; const N: Integer): TDateTime;
function AddDays(const D: TDateTime; const N: Integer): TDateTime;
function AddWeeks(const D: TDateTime; const N: Integer): TDateTime;
function AddMonths(const D: TDateTime; const N: Integer): TDateTime;
function AddYears(const D: TDateTime; const N: Integer): TDateTime;

{ }
{ Counting }
{ }
{ DayOfYear and WeekNumber start at 1. }
{ WeekNumber is not the ISO week number but the week number where week one }
{ starts at Jan 1. }
{ For reference: ISO standard 8601:1988 – (European Standard EN 28601). }
{ “It states that a week is identified by its number in a given year. }
{ A week begins with a Monday (day 1) and ends with a Sunday (day 7). }
{ The first week of a year is the one which includes the first Thursday }
{ (day 4), or equivalently the one which includes January 4. }
{ In other words, the first week of a new year is the week that has the }
{ majority of its days in the new year.” }
{ ISOFirstWeekOfYear returns the start date (Monday) of the first ISO week }
{ of a year (may be in the previous year). }
{ ISOWeekNumber returns the ISO Week number and the year to which the week }
{ number applies. }
{ }
function DayOfYear(const Ye, Mo, Da: Word): Integer; overload;
function DayOfYear(const D: TDateTime): Integer; overload;
function DaysInMonth(const Ye, Mo: Word): Integer; overload;
function DaysInMonth(const D: TDateTime): Integer; overload;
function DaysInYear(const Ye: Word): Integer;
function DaysInYearDate(const D: TDateTime): Integer;
function WeekNumber(const D: TDateTime): Integer;
function ISOFirstWeekOfYear(const Ye: Word): TDateTime;
procedure ISOWeekNumber(const D: TDateTime; var WeekNumber, WeekYear: Word);
function DateTimeAsISO8601String(const D: TDateTime): String;
function ISO8601StringAsDateTime(const D: String): TDateTime;

{ }
{ Difference }
{ Returns difference between two dates (D2 – D1). }
{ }
function DiffMilliseconds(const D1, D2: TDateTime): Int64;
function DiffSeconds(const D1, D2: TDateTime): Integer;
function DiffMinutes(const D1, D2: TDateTime): Integer;
function DiffHours(const D1, D2: TDateTime): Integer;
function DiffDays(const D1, D2: TDateTime): Integer;
function DiffWeeks(const D1, D2: TDateTime): Integer;
function DiffMonths(const D1, D2: TDateTime): Integer;
function DiffYears(const D1, D2: TDateTime): Integer;

{ }
{ Time Zone }
{ Uses systems regional settings to convert between local and GMT time. }
{ }
function GMTTimeToLocalTime(const D: TDateTime): TDateTime;
function LocalTimeToGMTTime(const D: TDateTime): TDateTime;
function NowAsGMTTime: TDateTime;

{ }
{ Conversions }
{ }
{ ANSI Integer is an integer in the format YYYYDDD (where DDD = day number) }
{ ISO-8601 Integer date is an integer in the format YYYYMMDD. }
{ TropicalYear is the time for one orbit of the earth around the sun. }
{ TwoDigitYearToYear returns the full year number given a two digit year. }
{ SynodicMonth is the time between two full moons. }
{ }
function DateTimeToANSI(const D: TDateTime): Integer;
function ANSIToDateTime(const Julian: Integer): TDateTime;
function DateTimeToISOInteger(const D: TDateTime): Integer;
function DateTimeToISO(const D: TDateTime): String;
function ISOIntegerToDateTime(const ISOInteger: Integer): TDateTime;
function TwoDigitRadix2000YearToYear(const Y: Integer): Integer;
function DateTimeAsElapsedTime(const D: TDateTime;
const IncludeMilliseconds: Boolean = False): String;


Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

Categorías

A %d blogueros les gusta esto: