Use of Date time

October 26, 2007 at 12:43 pm | In SQL Server | Leave a Comment

To display date in format : dd/mm/yyyy

convert(varchar(12),[field name],103)

To get records between two dates use following syntax in where condition.
Note : 1) Assuming that field type is varchar in database table.
2) From date & to date variables are in date format.

Convert(datetime,Convert(varchar(12),[field name])) between Convert(datetime,[from date variable] ) and Convert(datetime,[to date variable])

No Comments Yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.