Date Problem

bobnavisionbobnavision Member Posts: 159
I am trying to create date like this:::

EVALUATE(DD,COPYSTR(LineText,5,2));
EVALUATE(MM,COPYSTR(LineText,3,2));
EVALUATE(YY,COPYSTR(LineText,1,2));
ReturnDate := DMY2DATE(DD,MM,YY);
EXIT(ReturnDate);


But the Return date is showing me 06/08/0006 instead of
06/08/2006 or 06/08/06. Is this due to regional setting or do i need to write code for this. ](*,)

Regards,

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Try adding 2000 to the YY variable:
    ReturnDate := DMY2DATE(DD,MM,2000 + YY);
    
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • bobnavisionbobnavision Member Posts: 159
    Thanks Luc, that works!!
  • SteveOSteveO Member Posts: 164
    Watch out for the Year 2100 bug :D
    This isn't a signature, I type this at the bottom of every message
Sign In or Register to comment.