Results 1 to 8 of 8
  1. #1
    cyliyu is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    14

    5 Digits Date to Normal Date Format

    Is there a formula I can use to convert a 5-digit date to a standard date format?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why only 5 digits? Show examples.

    Maybe: CDate(5digits)
    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.

  3. #3
    cyliyu is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    14
    Quote Originally Posted by June7 View Post
    Why only 5 digits? Show examples.

    Maybe: CDate(5digits)
    It was because of the data type, however, I'd like to see whether there's a formula to convert back to date.


    Click image for larger version. 

Name:	Capture.JPG 
Views:	21 
Size:	24.6 KB 
ID:	47262

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What do you mean 'because of the data type'? Was this imported from Excel? Did you try the suggestion? Calculate in query or textbox.

    If you want to change data in table, can:

    1. first run an update action SQL
    UPDATE tablename SET fieldname = CDate(fieldname);

    2. now change field type to date/time
    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.

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by cyliyu View Post
    It was because of the data type, however, I'd like to see whether there's a formula to convert back to date.


    Click image for larger version. 

Name:	Capture.JPG 
Views:	21 
Size:	24.6 KB 
ID:	47262
    They appear to already be dates?, just the true numeric value?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi

    Looks like the data has been imported or copied from Excel.

    The field in the table just needs to be changed from Text to DateTime
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I tested just changing text to datetime and it failed. Try it yourself.

    The two-step method tested and worked.
    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.

  8. #8
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi June

    I believe you.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 6
    Last Post: 04-06-2020, 04:31 AM
  2. Replies: 3
    Last Post: 10-16-2017, 11:47 AM
  3. Replies: 3
    Last Post: 12-02-2014, 07:58 PM
  4. Replies: 0
    Last Post: 11-19-2014, 05:47 AM
  5. Replies: 3
    Last Post: 08-20-2014, 01: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