|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I am new to SQL Language. I would like to know if there is a function that will return only the date from a DateTime field? I noticed that the date in the SQL database is reversed. Example 2004-04-14 09:57:17.000. I would like the date only return when I execute a SQL Query like 04/14/2004.
Is this possible? If so, can someone help? Thanks Greatly appreciated. Herb |
|
#2
|
|||
|
|||
|
try this
even i was searching for tat .this works
select REPLACE(CONVERT(VARCHAR,Date_Field,3),'/','/') from Table_Name it gives the results in dd/mm/yy format try changing the 3rd parameter in the convert() to get different formats |
|
#3
|
||||
|
||||
|
If you're using mysql, the DATE_FORMAT() function is also an option.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#4
|
|||
|
|||
|
Answer
select col1, col2
From thisTable WHERE convert (datetime, convert (varchar, datecol, 101), 101) = @yourdate |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Converting DateTime to Date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|