Results 1 to 4 of 4
  1. #1
    Tascja is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2017
    Posts
    4

    Question Time format

    Hello,
    I have a table where I enter the time of an appointment in my TIME field. Its Data Type is Date/Time and its format is Medium Time. In Datasheet View the time display as hh:ss AM/PM (ie. 12:00 PM) but when I export the table to excel the time is displayed as a General Date (ie. 00/01/1900 12:00:00 PM). What am I doing wrong that the time exports as a Date + Time and not as it's displayed in Database?
    Any help or suggestions would be greatly appreciated.
    Thanks,


    Natascja

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,819
    Based on your description, I'd say you might not fully understand how date/time is stored and how the data interacts with different programs. It is usually best to store date AND time in one field and let your form controls display what parts of it you want to see. Excel shows 00/01/1900 12:00:00 PM because your source data contains no date (other than the default, but keep reading), so Excel defaults to the starting point for system dates, which is January 01 1900. Date/time is a floating point double precision number that can be formatted to appear in numerous ways. What you're seeing in Access is the format of the very same date that Excel is seeing. You can work around this with various means, subject to your level of expertise. The easiest might be to forego Excel in the first place if you don't really need it. Unless you're graphing or doing complex calculations, I have to wonder why use Excel at all when you have db data. Another possibility is to have macros in your sheet that fix the column format after the import/export, or simply do this manually.

    In short, the appearance in Excel isn't a mistake you're making - beyond possibly what I've already said about not splitting times from dates
    Last edited by Micron; 11-19-2018 at 03:35 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    Just to add to Micron's excellent explanation.
    Access uses the same idea as Excel but has a different starting point for dates.
    In Access, day zero was 30 Dec 1899.
    At the time it was decided, developers in the two apps clearly weren't communicating And afterwards it was too late to change things.
    However as date calculations in the two apps are internally consistent, the discrepancy doesn't actually matter
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    Tascja is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2017
    Posts
    4
    Thanks for your explanation Micron! I need to keep using Excel exports for some of my other tasks outside of Access so I'll take your suggestion to format the column to only display time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-16-2018, 04:58 PM
  2. Date Format and Time
    By adnancanada in forum Access
    Replies: 2
    Last Post: 02-23-2017, 10:47 PM
  3. Replies: 5
    Last Post: 07-24-2014, 07:54 AM
  4. Set Time Format
    By justair07 in forum Access
    Replies: 5
    Last Post: 08-19-2013, 12:08 PM
  5. Time format problem
    By Bdowns in forum Access
    Replies: 5
    Last Post: 02-08-2012, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums