Results 1 to 6 of 6
  1. #1
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296

    Curious about a potential bug?

    So I was using a query with format to format a date. I fixed the issue because I noticed I put 3 y's instead of 4 for the year but I was getting and odd result and was wondering how access got to this point?
    Actual date: 9/30/2022
    Code:
    Format(DateUpdated,'mm/dd/yyy') '3 y's instead of 4
    What Access returned: 09/30/22273



    Does anyone know how Access turned 2022 into 22273?

    Note: I don't believe it matters since it isn't modifying that field but there are some inner joins and other fields in the query.
    Access 2019

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Not a bug. It's the 2 digit year followed by the number of days since the start of the year (67 as of today from 12/31/2022).
    Test it with today's date and you'll get 2367.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Interesting. Just to make sure I understand this right, it takes the "23" from 2023 and then counts the days from 12/31/2022(the last day of the previous year)?

    So a single y just indicates to count the amount of days in the year?
    It doesn't work the same way with a single m or d (like a single m doesn't count the days in that month or d doesn't count the hours since the day started)
    Though I guess it makes sense that they don't. It just seems a bit bizarre of a feature.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Yes and yes.
    I agree - strange and not obvious to me why you'd use yyy. To get a day count from that would require parsing the string so easier to use DateDiff? If you just want elapsed days then format(Date(),"y") might be useful when compared to other methods. Since yyy gives you 2367 it stands to reason that y gives you 67 (it resembles concatenation to me).

    format(date(),"yy") > 23
    format(date(),"y") > 67
    format(date(),"yyy") > 2367
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Micron View Post
    Yes and yes.
    I agree - strange and not obvious to me why you'd use yyy. To get a day count from that would require parsing the string so easier to use DateDiff? If you just want elapsed days then format(Date(),"y") might be useful when compared to other methods. Since yyy gives you 2367 it stands to reason that y gives you 67 (it resembles concatenation to me).

    format(date(),"yy") > 23
    format(date(),"y") > 67
    format(date(),"yyy") > 2367
    Thanks for telling me how it works regardless!

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You're welcome.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 17
    Last Post: 12-28-2020, 06:39 PM
  2. Replies: 4
    Last Post: 08-14-2017, 11:52 AM
  3. A Curious Case of Resolution Trauma
    By Accessed in forum Access
    Replies: 6
    Last Post: 07-25-2016, 11:04 AM
  4. Hyperlink potential problems
    By honey2wood in forum Database Design
    Replies: 2
    Last Post: 03-03-2011, 01:11 PM
  5. Replies: 1
    Last Post: 02-27-2011, 06:50 AM

Tags for this Thread

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