MSSQL Date Operation Function Summary

Source: Internet
Author: User

SetAnsi_nulls onSetQuoted_identifier onGoALTER FUNCTION [dbo].[Ufn_getdateofweek](@Date Datetime)RETURNS nchar(1) asBEGIN DECLARE @returnValue nchar(1); SET @returnvalue =  Case DatePart(DW,@Date) when 2  Then 'a'                                                 when 3  Then 'two'                                                when 4  Then 'three'                                                when 5  Then 'Four'                                                when 6  Then 'Five'                                                when 7  Then 'Six'                                                when 1  Then 'Day'                       End; RETURN @returnValueEND   ---------------------SetAnsi_nulls onSetQuoted_identifier onGo  ALTER FUNCTION [dbo].[ufn_transdate]( @Date DATETIME)RETURNS nvarchar( -) as/*Action: Tell time to change to this format 01-18 14:00createdby:createddate:2011-01-19 11:44:12.920modifiedhistory:test scripts:print Dbo.ufn_transdate (' 2011-01-19 11:44:12.920 ')*/ BEGIN DECLARE @Str NVARCHAR( -)  SET @Str = Convert(Nvarchar( +),Convert(DateTime,@Date, -), -)  SET @Str = SUBSTRING(@Str,6, One)  RETURN @StrEND    ---------------------------------------SetAnsi_nulls onSetQuoted_identifier onGo  ALTER FUNCTION [dbo].[Ufn_transdate2]( @Date DATETIME)RETURNS nvarchar( -) as/*Action: Tell time to change to this format 2011-01-18createdby:createddate:2011-01-19 11:44:12.920modifiedhistory:test scripts:print D Bo.ufn_transdate2 (' 2011-01-19 11:44:12.920 ')*/ BEGIN DECLARE @Str NVARCHAR( -)  SET @Str = Convert(Nvarchar( +),Convert(DateTime,@Date, -), -)  SET @Str = SUBSTRING(@Str,1, One)  RETURN @StrEND    ----------------------------------------------

MSSQL Date Operation Function Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.