DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Pascal and Delphi (http://www.daniweb.com/forums/forum124.html)
-   -   Pascal Question (http://www.daniweb.com/forums/thread122573.html)

BinaryAssassin May 5th, 2008 12:17 pm
Pascal Question
 
Hey all,

I'm currently writing a program that will do various things with dates. The problem that I currently have is getting pascal to recognise dates in various formats (eg. 24/09/93 or 09-03-04 or 17 01 99, etc) when input by a user. This data needs to be read by pascal in a way that allows me to alter the output (ie. the date written out in full).

Any suggestions/solutions would be immensely appreciated.

Duoas May 5th, 2008 1:37 pm
Re: Pascal Question
 
Take a look through this thread:
Tutorial: Handling Dates and Time in Delphi

Near the bottom there is some thoughts on reading dates (which is the hard part). Writing dates is easy.

Hope this helps.

BinaryAssassin May 7th, 2008 10:14 am
Re: Pascal Question
 
Thanks for the link/ help, Duoas. I've never used Delphi before, and although I can see the similiarities, I'm generally new to the programming game so I'm having some trouble understanding it.

If you have any words of wisdom in the Pascal programming language, that would be very useful indeed. Thanks again.

Duoas May 9th, 2008 6:07 pm
Re: Pascal Question
 
Heh, glad to have helped.

I know it takes a while to get your head around it, but the only way it will come is to struggle along... alas. But it will come, don't worry. :)

One of the most overlooked features in Delphi (IMHO) is the use of try...except blocks in data transformation. In simple terms, endeavor to do things one way. If the input doesn't match, raise an exception and catch that to try another way. Keep going until you either run out of ways to try or until the input matches.

Good luck.


All times are GMT -4. The time now is 2:05 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC