Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76

    Dates

    I have a table with a date field set to General Date, in the table there is an input mask 99/99/0000.
    I have years of data collected and now I want to create a query that shows me the time: myTime: Format([orderDate],"Short Time")
    The results are 00:00.

    I thought all dates were stored as a serial number so you could go back and change the format to whatever you like. Please help with what i am missing.
    Thanks.

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    All dates in access are stored as a decimal number.

    The integer represents the day number starting from 1 representing 31/12/1899
    the decimal portion represents the time as a fraction - so right now in the immediate window gives you

    ?cdate(now)
    15/02/2019 15:46:06
    ?cdbl(cdate("15/02/2019 15:44:06"))
    43511.655625

    Do your dates have a time value ?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just to set the record straight here's the description of a date/time field: https://support.microsoft.com/en-us/...crosoft-access

  4. #4
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Sadly my dates only have integers.
    My table design says the dates are stored as General Date, so I thought this would also capture the fraction part of the date then my input mask would allow only the integer side of the date to be displayed.
    Is there any hope I can get the time data to come back?

  5. #5
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Personally I'd remove the input mask. They are a pain to use in real life.

    Do you still have any of your original data? Can you paste it into an excel sheet and look at the actual values ?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    I created a query, copied the date data and pasted it into Excel. Here is the resulting format:
    1/2/2019 0:00

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by ShostyFan View Post
    I created a query, copied the date data and pasted it into Excel. Here is the resulting format:
    1/2/2019 0:00
    That is consistent as there is ALWAYS a time value in a DateTime field, it is simply set to 0.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by ShostyFan View Post
    Sadly my dates only have integers.
    My table design says the dates are stored as General Date, so I thought this would also capture the fraction part of the date then my input mask would allow only the integer side of the date to be displayed.
    Is there any hope I can get the time data to come back?
    Just for the record, DateTime values are ALWAYS stored the same. The "General Date" to which you refer is simply a formatting option when displaying the value.

  9. #9
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Quote Originally Posted by RuralGuy View Post
    Just for the record, DateTime values are ALWAYS stored the same. The "General Date" to which you refer is simply a formatting option when displaying the value.
    I am not sure i understand, if they are always stored, how come I can't access the data? What do I need to do next?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm not sure what you mean when you say "how come I can't access the data?". What can't you access?

  11. #11
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Quote Originally Posted by RuralGuy View Post
    I'm not sure what you mean when you say "how come I can't access the data?". What can't you access?
    I can't access the time part of the date. The time is being displayed as 0:00

  12. #12
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    If you don't expressly enter a time value when storing a value in a date field, it defaults to zero on the right side of the decimal. In your case, the data IS there and you can get it - but it sounds like all values are zero hours minutes and seconds. If you enter 02/15/2019 in a date field you will store 02/15/2019 00:00:00 AM
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Quote Originally Posted by ShostyFan View Post
    I created a query, copied the date data and pasted it into Excel. Here is the resulting format:
    1/2/2019 0:00
    I meant copy and paste from your original data to ensure you did have the time portion of the data, not the access version.
    You had already stated none of your data in Access had any time information stored.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    I agree with Minty, copy some original dates from your Excel and see if the original capture had any non zero time values.
    It could be that your input mask suspended/voided any of the time values and Access used its 0 default.

  15. #15
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Quote Originally Posted by Micron View Post
    If you don't expressly enter a time value when storing a value in a date field, it defaults to zero on the right side of the decimal. In your case, the data IS there and you can get it - but it sounds like all values are zero hours minutes and seconds. If you enter 02/15/2019 in a date field you will store 02/15/2019 00:00:00 AM
    I get what you are saying. I don't want it to be true but it is
    Thanks.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-02-2017, 02:02 PM
  2. Replies: 2
    Last Post: 09-19-2017, 11:31 AM
  3. Replies: 8
    Last Post: 12-02-2013, 03:46 PM
  4. List Dates between Start and Finish Dates
    By Buddus in forum Queries
    Replies: 1
    Last Post: 07-26-2013, 01:58 PM
  5. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 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