Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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