Format a joined date time field in a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kadavu
    New Member
    • Apr 2010
    • 7

    #1

    Format a joined date time field in a query

    Table has a date field formatted as a short date dd/mm/yy, and a time field formatted as short time hh:nn. When I join those fields in a query
    ie. Date_Time:[Date]&"_"&[Time] the result is displayed as dd/mm/yyyy_hh:nn:ss in the query and the chart that is attached to it. I only want dd/mm/yy_hh:nn to be displayed.
    How can i change it. I have tried to format the joined field, and either and the query does not run or it makes no difference to the output.

    thankyou

    Brian
  • kadavu
    New Member
    • Apr 2010
    • 7

    #2
    SOLVED:- The trick is
    Date_Time:Forma t[Date]&"_"&[Time],"dd/mm/yy"&"_"&"hh:mm" )

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      Brian,

      I'd like to start by recommending strongly that you find other names than [Date] & [Time] to use in your project. While they work in most circumstances, they are reserved words, and as such should be avoided for names.

      For your query, I would suggest an alternative of :
      Code:
      Date_Time: Format([Date]+[Time],'dd/mm/yy\_hh:nn')
      Welcome to Bytes!

      Comment

      • kadavu
        New Member
        • Apr 2010
        • 7

        #4
        Originally posted by NeoPa
        Brian,

        I'd like to start by recommending strongly that you find other names than [Date] & [Time] to use in your project. While they work in most circumstances, they are reserved words, and as such should be avoided for names.

        For your query, I would suggest an alternative of :
        Code:
        Date_Time: Format([Date]+[Time],'dd/mm/yy\_hh:nn')
        Welcome to Bytes!
        Thank you NeoPa that works and is more elegant than my solution.
        Brian

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          Thank you. Always pleased to help :)

          Comment

          Working...