string edit replace - with /

hello,
i'm loading a date from an db file and i whant to change it from 12-01-2004 to 01/12/2004  
can someone tell me how to do this basic thing???

thanx greetz carlas
krydeaAsked:
Who is Participating?
 
Mohammed NasmanSoftware DeveloperCommented:
ohh sorry, I didn't notice you would to change the Day/Month

just add

  ShortDateFormat := 'M/d/yyyy';

Regards,
Mohammed
0
 
geobulCommented:
Hi,

function DateStringFormat(const d: string): string;
begin
  result := Copy(d,4,2)+'/'+Copy(d,1,2)+'/'+Copy(d,7,4);
end;

// usage:

ShowMessage(DateStringFormat('12-01-2004'));

Regards, Geo
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hi

Change the  "DateSeparator" global variable to any format you like as:

  DateSeparator := '/';
  ShowMessage(DateToStr(Date));

Regards,
Mohammed
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
mikelittlewoodCommented:
or

StringReplace(DateToStr(date), '-', '/', [rfReplaceAll])
0
 
mikelittlewoodCommented:
bleh  ><  didnt notice that either lol
0
 
geobulCommented:
And I thought krydea was talking about pure string manipulation ;-)
0
 
krydeaAuthor Commented:
sorry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.