CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    HOW: formatting date in sql

    hi,
    i got an Access db and i want to make an SQL query
    that retrieve a date field and but with this format (mm/yyyy).
    how do i do it in SQL (of access db)?
    anyone?

  2. #2
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    2,147
    You could try:

    Code:
    SELECT Format(Now(), "mm") + '/' + Format(Now(), "yyyy") AS MyDate;
    ...and substitute your date column for the calls to Now()

    Hope this helps,

    - Nigel

  3. #3
    Join Date
    Oct 2004
    Posts
    23

    Re: HOW: formatting date in sql

    Useful code,

    I used it to get a date in the form mm/dd/yy (I am in UK but needed to do this)

    Is there a way to get a date to show like this
    Thursday October 14, 2004 (note just one , ) also is there an option to add the two letters after the date ie 14th, 2nd etc. I can display the number but not the bit after.

    EDIT1
    I would also like to have the date as shown above all in one coloum I have done this and it works, but can I have tabs so that the Day, Date, Month, ,and year line up.

    Also can you add time in Access I get 00:00 for all using HH:nn
    Last edited by pjb007; October 14th, 2004 at 05:30 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured