×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

converting an integer field into a date

converting an integer field into a date

converting an integer field into a date

(OP)
Greetings,

I'm working with a proprietary database system that I connect to over ODBC.

This proprietary database stores dates as integers (don't blame me, I didn't design it). So the date 1/11/2010 would be stored as 1100111. When you add 1100111 and 19000000 you get year month date - the method to the madness.

What I need to do is create a query that gives me all the records for this month, and 5 months after. The bigger picture is I'm creating a TRANSFORM query to do a crosstab report.  Working with dates is easy, but these are not dates, they're integers.

Any help is appreciated.

"If it's stupid but works, it isn't stupid."
  -Murphy's Military Laws

RE: converting an integer field into a date



Hi,

Well you add the two value and you do get an integral number, in this case, 20100111.

But you cannot hand this as a single value in the conversion.  The conversion will depend on your proprietary system's date system, the syntax for extracting left, mid and right values.

Two that I am familiar with...

CODE

Select TO_DATE
 (
   SUBSTR([YourDate]+19000000,1,4)||'/'||
   SUBSTR([YourDate]+19000000,5,2)||'/'||
   SUBSTR([YourDate]+19000000,7,2),'yyyy/mm/dd'
 )

Select DateSerial
 (
   MID([YourDate]+19000000,1,4),
   MID([YourDate]+19000000,5,2),
   MID([YourDate]+19000000,7,2)
 )

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close