|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Convert date without seconds - dd mon yyyy hh:mi(24h)Hi,
How is it possible to convert date without seconds ? dd mon yyyy hh:mi(24h) Cant find that convert() has an option for this. Thanks Totto select CONVERT(CHAR(16),GETDATE(),120)
-- Show quoteAndrew J. Kelly SQL MVP "Totto" <tor.aadne***@losmail.no> wrote in message news:%23PLzUEHyGHA.4204@TK2MSFTNGP04.phx.gbl... > Hi, > How is it possible to convert date without seconds ? > dd mon yyyy hh:mi(24h) > Cant find that convert() has an option for this. > Thanks Totto > > Totto wrote:
> Hi, CONVERT(char(11), getdate(), 113)> How is it possible to convert date without seconds ? > dd mon yyyy hh:mi(24h) > Cant find that convert() has an option for this. > Thanks Totto > > Wow this doesn't have hours or minutes either... I think you meant:
SELECT CONVERT(CHAR(17), CURRENT_TIMESTAMP, 113); Show quote "Jeffrey Williams" <jeff.willi***@sharp.com> wrote in message news:uBb$LMHyGHA.2300@TK2MSFTNGP05.phx.gbl... > Totto wrote: >> Hi, >> How is it possible to convert date without seconds ? >> dd mon yyyy hh:mi(24h) >> Cant find that convert() has an option for this. >> Thanks Totto >> >> > > CONVERT(char(11), getdate(), 113) Jeffrey Williams wrote:
> Totto wrote: sorry - misread and excluded the time portion. Just increase the number >> Hi, >> How is it possible to convert date without seconds ? >> dd mon yyyy hh:mi(24h) >> Cant find that convert() has an option for this. >> Thanks Totto >> >> > > CONVERT(char(11), getdate(), 113) of characters you need in your output. And, change the format (113) to the specific format you want. The simplest syntax is to just convert into a datatype that is only large
enough to hold up to the minutes: SELECT CONVERT(NCHAR(17),GETDATE(),113); If you were using larger strings, such as having a NCHAR(23) variable with the string already in it, you could also use either SUBSTRING or LEFT to truncate the seconds. -- Alan Brewer [MSFT] Content Architect, SQL Server Documentation Team Download the latest Books Online update: http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx This posting is provided "AS IS" with no warranties, and confers no rights. Thanks all
Totto Show quote "Totto" <tor.aadne***@losmail.no> wrote in message news:%23PLzUEHyGHA.4204@TK2MSFTNGP04.phx.gbl... |
|||||||||||||||||||||||