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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Date in DDMMYYYY format

Status
Not open for further replies.

choongyin

Programmer
Feb 13, 2003
6
MY
Hi there,

I tried to export a date into DDMMYYYY format. The date is exported into del format file. I'm able to extract the day, month, year and concatenate it to DDMMYYYY. But it is of string and the date exported to the file will be quoted with "" for eg. "02022003". But I don't want the date be quoted. Therefore, I used Integer() function to avoid this. Too bad that the leading 0 is lost when Integer() applied. Could someone helps on this?

Thanks & rgds
 
I expect every numeric output to loose the leading zero, no matter what you try. Did you try to wrap the DIGITS() function around the integer? T. Blom
Information analyst
tbl@shimano-eu.com
 
Have you tried the char function concatinating mm | dd | yyyy within it?
IT DB2 DBA
 
Hi there,

This is my test statement, which returning "02022003" as eg.

export to C:\test.txt of del select case when day(thedate) < 10 then '0'||cast(day(thedate) as char(1)) else cast(day(thedate) as char(2)) end || case when month(thedate) < 10 then '0'||cast(month(thedate) as char(1)) else cast(month(thedate) as char(2)) end || cast(year(thedate) as char(4)) from mydate

While I used integer() to wrap the result as below:

export to C:\test.txt of del select integer(case when day(thedate) < 10 then '0'||cast(day(thedate) as char(1)) else cast(day(thedate) as char(2)) end || case when month(thedate) < 10 then '0'||cast(month(thedate) as char(1)) else cast(month(thedate) as char(2)) end || cast(year(thedate) as char(4))) from mydate

it returns 2022003.

When I used digits() on the statement above:

export to C:\test.txt of del select digits(integer(case when day(thedate) < 10 then '0'||cast(day(thedate) as char(1)) else cast(day(thedate) as char(2)) end || case when month(thedate) < 10 then '0'||cast(month(thedate) as char(1)) else cast(month(thedate) as char(2)) end || cast(year(thedate) as char(4)))) from mydate

it will return &quot;0002022003&quot;.

How to obtain 02022003 then? (Note: No double quote wanted)

Thanks & rgds
 
The digits() idea was a bit of an intuitive suggestion..........
You may be stuck with the situaton as it is, cause 02022003 is definitely a string. I suggest doing a replace action on the exported data-set to get rid of the &quot;&quot; ........ T. Blom
Information analyst
tbl@shimano-eu.com
 
Hi there,

Does anyone knows how to do load a 'tab' delimited flat file into db2 table?

Thanks & rgds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top