{*******************************************************}
{                                                       }
{       Administración de puntos de venta               }
{                                                       }
{       Copyright (C) 2006 Rodax Software S.L.          }
{                                                       }
{*******************************************************}

unit uDateUtils;

interface

function NumberDayOfTheWeek(const ADay : String) : Word;
function NumberMonthOfTheYear(const AMonth : String) : Word;

implementation

uses
  DateUtils;

function NumberDayOfTheWeek(const ADay : String) : Word;
begin
  if (ADay = 'Monday') or (ADay = 'Lunes') then
    Result := DayMonday;
  if (ADay = 'Tuesday') or (ADay = 'Martes') then
    Result := DayTuesday;
  if (ADay = 'Wednesday') or (ADay = 'Miercoles') or (ADay = 'Miércoles') then
    Result := DayWednesday;
  if (ADay = 'Thursday') or (ADay = 'Jueves') then
    Result := DayThursday;
  if (ADay = 'Friday') or (ADay = 'Viernes') then
    Result := DayFriday;
  if (ADay = 'Saturday') or (ADay = 'Sabado') or (ADay = 'Sábado') then
    Result := DaySaturday;
  if (ADay = 'Sunday') or (ADay = 'Domingo') then
    Result := DaySunday;
end;

function NumberMonthOfTheYear(const AMonth : String) : Word;
begin
  if (AMonth = 'January') or (AMonth = 'Enero') then
    Result := 1;
  if (AMonth = 'February') or (AMonth = 'Febrero') then
    Result := 2;
  if (AMonth = 'March') or (AMonth = 'Marzo') then
    Result := 3;
  if (AMonth = 'April') or (AMonth = 'Abril') then
    Result := 4;
  if (AMonth = 'May') or (AMonth = 'Mayo') then
    Result := 5;
  if (AMonth = 'June') or (AMonth = 'Junio') then
    Result := 6;
  if (AMonth = 'July') or (AMonth = 'Julio') then
    Result := 7;
  if (AMonth = 'August') or (AMonth = 'Agosto') then
    Result := 8;
  if (AMonth = 'September') or (AMonth = 'Septiembre') or (AMonth = 'Setiembre') then
    Result := 9;
  if (AMonth = 'October') or (AMonth = 'Octubre') then
    Result := 10;
  if (AMonth = 'November') or (AMonth = 'Noviembre') then
    Result := 11;
  if (AMonth = 'December') or (AMonth = 'Diciembre') then
    Result := 12;
end;

end.
 