View Thread
 Print Thread
Function to convert Date to YYYYMMDDHHMMSS
admin

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[udf_YYYYMMDDHHMMSS] ( @DATE DATETIME )
RETURNS VARCHAR(15)
AS
    BEGIN

        DECLARE @newDate VARCHAR(15)
        SELECT  @newDate = CONVERT(CHAR(8), @DATE, 112) + REPLACE(CONVERT(CHAR(8), @DATE, 108), ':', '')
        RETURN(@newDate)
    END
GO

Jordon Pilling | Heavencore Administrator
 
Jump to Forum