I am currently creating a Delphi Application with SQL connections integrated.
SQL stores its date values in the format YYYY-MM-DD, however, when I read these values within my Delphi application, they are read in the format MM-DD-YYYY.
I have currently written the code to read the values of the dates from my database, however I am having trouble processing values which do not have 2 month integers or 2 day integers. For example, the date 17th of February 2013 would be read as '2/17/2013'
My current code separates the date into day, month and year. It works well for full dates (MM/DD/YYYY) as it reads the corresponding values within the text using the 'Copy' command within Delphi. When it reads a date which is in the format M/D/YYYY it does not copy the correct values from the string.
Is there any way to edit the string before I run my separation code, so that it forces the string into the format of MM/DD/YYYY. My idea is to write code to check the format of the string and then add any zeros which are missing: i.e change 2/17/2013 into 02/17/2013
I know I'm probably doing something to make things harder for myself, but this is my code at this point in time, so any help to fix my problem by adding to my current code would be much appreciated.
Thanks, A.