Results 1 to 9 of 9
  1. #1
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37

    Date and Time Formatting

    I need access to read the date and times on records as an integer(Date) with a decimal(time). Is there anyway to do this?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Perhaps this link will help: http://support.microsoft.com/kb/q130514/en-us

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    give an example of the input and what you want the output to be.

  4. #4
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    Ok, so I have a table that is recording the records with a date/time of format DD/MM/YYY 00:00:00 AM and I need to be able to convert that to a Julian format so that I can organize the Records based on the month. I have thought of another way to do it but I am not entirely sure that it will work and it would take alot more work...

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    assume your datefield is called OriginalDate

    you can get the julian date like this

    DateDiff("d",CDate("1/1/" & DatePart("yyyy",[originaldate])),[originaldate])+1

  6. #6
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    Thanks guys, the DateDiff worked and I figured it out.

  7. #7
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    Is there any way to get that datediff to include the year as well? As it is it only computes for the month eg. 1/4/2001=4 instead of some large number

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If you have the julian date you don't need the month to sort them, or is the month purely for a visual thing? You can get the month of any date by

    datepart("<time portion>", [FieldName])

    i.e. datepart("d",[OriginalDate])

    would give you the day, some of your time portions are

    d (day), m(month), n(minute), y or yyyy (year)

  9. #9
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    Its okay I got it to work. Thank you for all of your help, Then database turned out really well!

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

Similar Threads

  1. Replies: 12
    Last Post: 02-22-2011, 03:39 PM
  2. Replies: 6
    Last Post: 01-04-2011, 05:43 PM
  3. Conditional Formatting date due color
    By Desstro in forum Programming
    Replies: 1
    Last Post: 12-08-2010, 11:12 PM
  4. Formatting a date
    By NISMOJim in forum Queries
    Replies: 7
    Last Post: 09-17-2010, 05:44 PM
  5. regional settings for Date Formatting
    By marianne in forum Access
    Replies: 3
    Last Post: 06-07-2009, 11:53 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