Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format 6-Character Date Field For DB2

Status
Not open for further replies.

jtrapat1

Programmer
Jan 14, 2001
137
0
0
US
I'm reading in a file and I have a six character date field coming in like this: 060299
so, it's month day year format.
I know I need a y2k check so I can add 20 or 19 to my year field.

But does anyone have a good function to format the rest of my string.

I think db2 expects the date in this format: '0001-01-01-00.00.00.00.0000'
for date and timestamp.

Thanks in Advance.
John
 
My plan of attack is to spend one hour looking into the help files and or surfing the www. after that I just attack it myself. The learning process of parsing the string and interpreting the results I garantee you wil be
invaluable to you in the future. I personnaly feel that some are to quick to look for an easy answer ie 'function' that they completely miss the opporunity to grow. I once spent a week writing the code for a function that returned the dos 8.3 format from a windows file path. two months
later I discovered the function to do this. I dont regret the week spent. You will not be reinventing the wheel. You will be building confidence and skill. By the way I do recognize that some problems are to complicated to code yourself. This excercise is just the type of problem to code yourself.

parse the string into 3 two character substrings.
and then develop an algorithn to interpret each substring.
less than 50 lines of code more than likely.

have fun :)

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top