PC Review


Reply
Thread Tools Rate Thread

Dates in Query Century 2030 vs 1939

 
 
JK
Guest
Posts: n/a
 
      27th Apr 2009
I have a table that I've linked to a J.D. Edwards database using an ODBC
driver. The table or data that I'm pulling from Edwards is our Item Master
table; containing all of our company products. There are a couple of date
fields in the table. First of all, there is the effective date which is the
date the item was added to the system. And secondly, there is the expired
date field which is the date the item's existing price will expire.

The data in the date fields come through as Access Table Data Type, Text.
The dates look like this 12/30/30 (i.e. the item's price in the system will
expire 30-Dec-2030.)

However, & this is the problem; when I run a query using the data mentioned
above, instead of the year being 2030 it's 1930. How do I get it to recognize
the century?

Any ideas or suggestions would be greatly appreciated.

Regards,
Jason


 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      28th Apr 2009
On Mon, 27 Apr 2009 06:33:01 -0700, JK <jasonk at necoffeeco dot com> wrote:

>I have a table that I've linked to a J.D. Edwards database using an ODBC
>driver. The table or data that I'm pulling from Edwards is our Item Master
>table; containing all of our company products. There are a couple of date
>fields in the table. First of all, there is the effective date which is the
>date the item was added to the system. And secondly, there is the expired
>date field which is the date the item's existing price will expire.
>
>The data in the date fields come through as Access Table Data Type, Text.
>The dates look like this 12/30/30 (i.e. the item's price in the system will
>expire 30-Dec-2030.)
>
>However, & this is the problem; when I run a query using the data mentioned
>above, instead of the year being 2030 it's 1930. How do I get it to recognize
>the century?
>
>Any ideas or suggestions would be greatly appreciated.
>
>Regards,
>Jason
>


By default, two digit dates between 00 and 29 are interpreted as being in the
21st century, those between 30 and 99 as being in the 20th. Why J.D.Edwards is
using two digit dates for investment products (which could span decades!) is
beyond me, and why they're using a Text field for dates suggests database
incompetence!

If you can count on this date as certainly being in the future (or in the 21st
century at any rate) you can use

IIF(Year([datefield]) < 2000, DateAdd("yyyy", 100, [datefield]), [datefield])

to calculate the corrected date.
--

John W. Vinson [MVP]
 
Reply With Quote
 
Armen Stein
Guest
Posts: n/a
 
      28th Apr 2009
On Mon, 27 Apr 2009 06:33:01 -0700, JK <jasonk at necoffeeco dot com>
wrote:

>I have a table that I've linked to a J.D. Edwards database using an ODBC
>driver. The table or data that I'm pulling from Edwards is our Item Master
>table; containing all of our company products. There are a couple of date
>fields in the table. First of all, there is the effective date which is the
>date the item was added to the system. And secondly, there is the expired
>date field which is the date the item's existing price will expire.
>
>The data in the date fields come through as Access Table Data Type, Text.
>The dates look like this 12/30/30 (i.e. the item's price in the system will
>expire 30-Dec-2030.)
>
>However, & this is the problem; when I run a query using the data mentioned
>above, instead of the year being 2030 it's 1930. How do I get it to recognize
>the century?
>
>Any ideas or suggestions would be greatly appreciated.


Hi Jason,

Access is assuming the century correctly according to its rules. To
override them in your query, you can use a calculated column:

CorrectedExpDate:
IIf(CDate([MyExpDate])<#1/1/1980#,DateAdd('yyyy',100,CDate([MyExpDate])),CDate([MyExpDate]))

The above technique assumes that any year lower than '80' will be
considered to be in the future, that is, 20xx - you can change the
value to whatever works for you.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with sorting 19th century dates =?Utf-8?B?Um9iZXJ0IEp1ZGdl?= Microsoft Excel Worksheet Functions 2 8th Jan 2007 02:17 AM
It dates a century back!! Sreee Spyware Application Compatibility 3 15th Feb 2005 09:57 PM
It dates a century back!!! Sree Security and Anti-Spyware Community 1 11th Feb 2005 08:03 AM
Excel Treats All Dates from the Previous Century as TEXT & Can't Change Format AJWatson Microsoft Excel Worksheet Functions 1 6th Nov 2003 11:37 PM
Handles Dates in 19th Century Wrong Jerry Malone Microsoft Excel Misc 2 10th Aug 2003 04:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:53 AM.