Results 1 to 3 of 3
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    Convert date to it's numerical equivalent in a query


    How can I convert a date format to it's numerical equivalent inside of a query? For instance, 1/1/2014 to be 41640.

    Thanks

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Assuming that your Date field is stored as Date and not Text, one way is to use one of the numeric conversion functions, like CDbl:

    CDbl([DateField])

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Be aware, all the number conversion functions will error on Null and alpha/empty string. So if there is possibility field is Null, need to handle.

    CDbl(Nz([DateField]))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-11-2013, 09:49 AM
  2. Query to convert String to Date??
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 06-04-2012, 04:48 PM
  3. Query Numerical and Text
    By Athyne in forum Queries
    Replies: 1
    Last Post: 01-14-2012, 12:07 AM
  4. Equivalent MsAccess Query
    By noviceUser in forum Access
    Replies: 2
    Last Post: 09-18-2010, 06:03 AM
  5. Numerical Value based on Date
    By jbarrum in forum Access
    Replies: 4
    Last Post: 03-11-2010, 01:04 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