//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "DayOfWeek.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: DayOfWeek
// Routine: SysUtils.DayOfWeek
// Routine: SysUtils.StrToDate

// BeginCode
/*
This example uses an edit box and a button on a form. When
the user enters a date in the edit box in the format
associated with the current locale (for example MM/DD/YY
format in the US), the string entered is converted to a
TDateTime value. This value is used to indicate the day of
the week the date represents.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  char days[7][10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
  TDateTime dtDate = StrToDate(Edit1->Text);
  ShowMessage(Edit1->Text + AnsiString(" is a ") + days[dtDate.DayOfWeek() - 1]);
}
// EndCode
// EndExample: DayOfWeek
//---------------------------------------------------------------------------
