PC Review


Reply
Thread Tools Rate Thread

30/12/1899 Error when importing Time from Excel to Access

 
 
Jack
Guest
Posts: n/a
 
      21st Jan 2010
Hi Access Stars,

I was trying to import data from Excel to Access. I got one colume on my
excel spreadsheet recording the time information as below:

Exam Time Final
9:00:00 AM
9:00:00 AM
9:00:00 AM

After I imported the data to Access, it becomes:

Exam Time Final
30/12/1899 9:00:00 AM
30/12/1899 9:00:00 AM
30/12/1899 9:00:00 AM


Any idea how to get rid of 30/12/1899 and where it comes from? Thanks!

--
Jack
 
Reply With Quote
 
 
 
 
Roger Carlson
Guest
Posts: n/a
 
      21st Jan 2010
Both Access and Excel store dates as double-precision numbers. The "whole
number" part represents the day (starting with 1/1/1900) and the decimal
portion represents the time. Day 1 is 1/1/1900. Day 0 (zero) is
12/31/1899. Internally, #30/12/1899 9:00:00 AM# is stored as -0.375. I
don't know why your dates are being imported with a negative.

In order to see what's going on, ON A COPY OF YOUR TABLE, change the
Date/Time field to a Double (choose Number as the type and Double as the
field size) and look at what the field is actually storing.

The solution may be as simple as multiplying the field by -1 (to get rid of
the negative) and display the Date/Time field with a time format.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L


"Jack" <(E-Mail Removed)> wrote in message
news:FD45DBCB-F3F8-4A68-8D42-(E-Mail Removed)...
> Hi Access Stars,
>
> I was trying to import data from Excel to Access. I got one colume on my
> excel spreadsheet recording the time information as below:
>
> Exam Time Final
> 9:00:00 AM
> 9:00:00 AM
> 9:00:00 AM
>
> After I imported the data to Access, it becomes:
>
> Exam Time Final
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
>
>
> Any idea how to get rid of 30/12/1899 and where it comes from? Thanks!
>
> --
> Jack



 
Reply With Quote
 
Jerry Whittle
Guest
Posts: n/a
 
      21st Jan 2010
Access stores dates as numbers and not anything that actually looks like
20/01/2010. It formats that number into a "date".

Just a few seconds ago Access says that the time was 40199.4264467593. The
40199 is the number of days. The decimal part is the time. Noon is .5.

Guess what day 0 is? Yep. 30/12/1899. (There's a long reason why it isn't
31/12/1899 or even 1/1/1900, but I digress.)

Therefore the plain 9:00:00 AM is stored as 0.375 which gets you the strange
year.

You can just format the date to show only the time.

Format([FieldName], "Medium Time")
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Jack" wrote:

> Hi Access Stars,
>
> I was trying to import data from Excel to Access. I got one colume on my
> excel spreadsheet recording the time information as below:
>
> Exam Time Final
> 9:00:00 AM
> 9:00:00 AM
> 9:00:00 AM
>
> After I imported the data to Access, it becomes:
>
> Exam Time Final
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
>
>
> Any idea how to get rid of 30/12/1899 and where it comes from? Thanks!
>
> --
> Jack

 
Reply With Quote
 
Sylvain Lafontaine
Guest
Posts: n/a
 
      21st Jan 2010
There is no Date or Time fields in Access, the only thing that exists is the
DateTime field which is both a date plus a time. If you import a time
value, it is converted to a datetime automatically with the addition of the
date 30/12/1899 as the date part. You cannot do anything to stop that or to
remove that if you want to keep a DateTime field (instead for say, to use a
characters field to store the time as a fully formated string).

Many controls in Access will understand that and won't display the date,
only the time, when it is 30/12/1899. However, it's still there.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)


"Jack" <(E-Mail Removed)> wrote in message
news:FD45DBCB-F3F8-4A68-8D42-(E-Mail Removed)...
> Hi Access Stars,
>
> I was trying to import data from Excel to Access. I got one colume on my
> excel spreadsheet recording the time information as below:
>
> Exam Time Final
> 9:00:00 AM
> 9:00:00 AM
> 9:00:00 AM
>
> After I imported the data to Access, it becomes:
>
> Exam Time Final
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
> 30/12/1899 9:00:00 AM
>
>
> Any idea how to get rid of 30/12/1899 and where it comes from? Thanks!
>
> --
> Jack



 
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
Error during importing data from Access to Excel Orsi Microsoft Access External Data 0 13th Jun 2009 09:07 AM
Error Importing Excel Spreadsheet into Access Jason Microsoft Access 1 21st Dec 2007 06:01 PM
Syntax Error when importing from Access to Excel =?Utf-8?B?TGVh?= Microsoft Access Queries 2 18th Mar 2006 12:23 PM
Error importing Excel into Access =?Utf-8?B?QWxseXNvbg==?= Microsoft Access External Data 4 7th Jun 2005 06:18 PM
Help With importing Outlook email time stamps into Access or Excel =?Utf-8?B?TmF0aGFu?= Microsoft Access External Data 0 8th Nov 2004 02:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:35 PM.