Solved

1/1/1990 and 12/30/1899 default dates

Posted on 2000-05-01
8
859 Views
Last Modified: 2012-08-14
When using a script, or the a dll, to add a new record to the db. Dates are automatically defaulted to 12/30/1899 when only time is specifed. So, for instance if i have code:
dbrst("dttime") = time()
Then it will automatically append 12/30/1899 in there.
But the default date for the database is 1/1/1990. So, I've been having date comparision problems.. Is this a known problem? Could it be our ado? We have the latest version.

I'm really stumped. Please help.
0
Comment
Question by:thyd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:manchula
ID: 2768035
This is not your ADO problem. Why don't you try this?

dbrst("dttime") = Date() + Time()
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2768612
I confirm that you should add the date part manually.
In fact, the 1/1/1990 corresponds to
31/12/1899 24:00. While supplying a time, only that part is replaced, and you end up with the 31/12/1899 as date.
0
 

Author Comment

by:thyd
ID: 2770051
Sorry, that's not what i'm looking for.
It's because in sql online help it states that the default is 1-1-1900.
And when using addnew function it appends 12-31-1899. But when using the insert function, or update function it appends 1-1-1900.

Please help.

Thanks..
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 6

Accepted Solution

by:
Jon_Raymond earned 100 total points
ID: 2771940
SQL Server uses a different numeric base to store dates than VB does.  Dates are actually stored as integers.  In VB the base 0 equates to 12/31/1899 00:00:00, in SQL 0 equates to 1/1/1900 00:00:00.  In VB today's date converts to 36649; in SQL it's 36647.  I think this is the root of the problem.  If one procedure uses SQL processes to compute the date and another uses VB then the discrepancy will occur.
0
 
LVL 6

Expert Comment

by:Jon_Raymond
ID: 2771947
Correction: the VB 0 base is 12/30/1899 00:00:00
0
 

Author Comment

by:thyd
ID: 2774142
Jon,

Is there a way to solve the problem?


Thanks...
0
 
LVL 6

Expert Comment

by:Jon_Raymond
ID: 2775878
Good question.  I don't have a cover-all answer.  When I last delt with this I deliberately used 12/30/1899 as the zero date value, because all blank dates were appearing as that value.  So I queried for dates that were > 12/30/1899 instead of dates that were not null.  I haven't seen the situation you describe, but you probably have to deal with each circumstance.  You might be able to add 1/1/1990 to the time value, for example.  It depends on the situation.
0
 

Author Comment

by:thyd
ID: 2777861
I'll accept your first comment, as an answer. We really didn't want to append extra values to the time.

Thanks for answering.

Thy
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question