Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 794
  • Last Modified:

How to convert this datetime Thu Sep 23 19:34:06 IST 2010 to mm/dd/yyyy format

How to convert this datetime Thu Sep 23 19:34:06 IST 2010 to mm/dd/yyyy
0
Loganathan Natarajan
Asked:
Loganathan Natarajan
3 Solutions
 
wshark83Commented:
here's a useful link which converts dates to various formats:

http://www.sqlusa.com/bestpractices/datetimeconversion/

basically you need to use the convert(datetime,<datefield>) functions
0
 
sachitjainCommented:
set @date = CONVERT(varchar(25), @dt, 101)

where @dt is your input datetime parameter i.e. Thu Sep 23 19:34:06 IST 2010
0
 
Anthony PerkinsCommented:
How to convert this datetime Thu Sep 23 19:34:06 IST 2010 to mm/dd/yyyy format
Assuming that value is not a datetime data type (otherwise the question would never have been posed) than I suspect you need something like this:
SELECT CONVERT(varchar(10), CAST(SUBSTRING(@YourDate, 5, 6) + ',' + RIGHT(@YourDate, 4) AS date), 101)
0
 
Loganathan NatarajanLAMP DeveloperAuthor Commented:
thanks
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now