Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Sql problem with dates


  • Please log in to reply

#1
prasharry2k5

prasharry2k5

    Member

  • Member
  • PipPip
  • 80 posts
I am working on mysql and need to know how to use the datetime datatype in such a way that i get only date displayed and not time and also i want the date to be in dd/mm/yyyy format. Plz tell me how to use this feature and get what i want.
  • 0

Advertisements


#2
Dan

Dan

    Trusted Tech

  • Retired Staff
  • 1,771 posts
Hello prasharry2k5,

Could you please explain why you're trying to use the DATETIME type if you only want the date? The following piece of code will give you the current date in the format that you asked..
SELECT date_format(CurDate(), '%d/%m/%y')
Alternately, if you're trying to access a date from a table:
SELECT date_format(column, '%d/%m/%y') FROM table
Since you didn't really specify what you were trying to access / why, I'm afraid that's the best I can offer.

- Dan
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP