Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Datetime

Status
Not open for further replies.

inaranjo

Programmer
Sep 17, 2004
7
0
0
EC
Hi,

Does any one know how to obtain a date format "Mon dd yyyy hh:miAM" from "yyyy-mm-dd" adding the seconds?
In Oracle I can use the following:

select to_char(to_date('2004-09-30','yyyy-mm-dd hh24:mi:ss')+(86346/86400),'Mon dd yyyy hh24:mi:ss') from dual

Being 2004-09-30 the date and 96346 the seconds to obtain: "Sep 30 2004 23:59:06"

Thanks in advance,
Ivonne
 
Assuming the field is a datetime

select convert(char(17),YourDatetimeHere,109)+substring(convert(char(26),YourDatetimeHere109),25,2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top