If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > How to strip time of from a date field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-11-11, 09:15
pbangalore pbangalore is offline
Registered User
 
Join Date: Nov 2009
Posts: 14
How to strip time of from a date field

I have a date field, which has data like 3/31/2011 12:00:00.000 AM, and i need to strip the time off and just get the date. I would like to have it in a query and need to know if i can do this without using datepart.
Reply With Quote
  #2 (permalink)  
Old 04-12-11, 15:14
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Use the convert function e.g.
select convert(date,getdate())
select convert(char(10),getdate(),101)
Reply With Quote
  #3 (permalink)  
Old 04-19-11, 06:02
mbarath mbarath is offline
Registered User
 
Join Date: Apr 2011
Posts: 3
Thumbs up

Use

select convert(char(10),'31/03/2011',103)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On