date

date(): Date;

The date method of the TimeStamp primitive type returns a date that is the same as the date part of the receiver.

If you change the date returned by the date method using the setDate method of the Date primitive type, you are not actually changing the date part of the timestamp.

vars
    ts : TimeStamp;
begin
    ts.date.setDate(1,2,2007);  // does not change ts

To change the date part of a timestamp, use the setDate method of the TimeStamp primitive type:

vars
    ts : TimeStamp;
    d  : Date;
begin
    d.setDate(1,2,2007);
    ts.setDate(d);              // does change ts