extracting data and converting AS400 date format

Tags:
as/400 data
AS/400 date format
hi, this question is very simple I should guess.. I am trying to extract data from AS400 into excel, and since date format is CYMD, I want it to show in a MM/DD/YYYY format. Please show me how.. Thank you very much! p.s. in SQL please

Answer Wiki

Thanks. We'll let you know when a new response is added.

SELECT
days(date(substr(digits(field),5,2) || ‘/’
|| substr(digits(field),7,2) || ‘/’
|| substr(digits(field),3,2))) –
days(date(’01/01/1900′)) + 1 as excel_serial_date_number
FROM file1

Excel stores dates as a serial number (1 = 1/1/1900, 2 = 1/2/1900, …)

Unfortunately when you bring this in, you then need to format the column in Excel as date to see it.

____________________________________________________________
…unless you cast it as a CHAR field first.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • MasterJediWannabe
    geee.. thanks a lot! it sure is a great help!ΓΌ
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following