hi there, it's me again
i found this code on the net how to calculate the current day from a date i write in a maskedit.
this code works perfect for me, BUT ! i have from the beginning forced my maskedit1.text to show the current date in YYYY-MM-DD format
so if i choose english keyboard layout that have the M/D/YYYY format, it get a error like this
'2005-05-08' is not a valid date and time'
how can i do to force the calculation so it always use the YYYY-MM-DD format ?
Thanks
i found this code on the net how to calculate the current day from a date i write in a maskedit.
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
MyDate: TDateTime;
begin
MyDate:=StrToDateTime(MaskEdit1.Text);
case DayOfWeek(MyDate) of
1: Label2.Caption:='Sunday';
2: Label2.Caption:='Monday';
3: Label2.Caption:='Tuesday';
4: Label2.Caption:='Wednesday';
5: Label2.Caption:='Thursday';
6: Label2.Caption:='Friday';
7: Label2.Caption:='Saturday';
end;
end;
this code works perfect for me, BUT ! i have from the beginning forced my maskedit1.text to show the current date in YYYY-MM-DD format
Code:
MaskEdit1.text := formatdatetime('yyyy-mm-dd', Now);
so if i choose english keyboard layout that have the M/D/YYYY format, it get a error like this
'2005-05-08' is not a valid date and time'
how can i do to force the calculation so it always use the YYYY-MM-DD format ?
Thanks