Skip to main content

Posts

Showing posts from March, 2014

sql server - Create a date from Time -SQL

7 To 9 DECLARE @startDate datetime = DateAdd(hour, 7, DateAdd(day, 0, cast(floor(cast(getdate() as float))as datetime))) DECLARE @endDate datetime = DateAdd(hour, 7+5+9, DateAdd(day, 0, cast(floor(cast(getdate() as float))as datetime))) Select @startDate as startDate Select @endDate as endDate IF (@startDate >= GETDATE() and GETDATE() <= @endDate) BEGIN Print 'true' END ELSE BEGIN Print 'false' END

Search keyword highlight in ASP.Net

public static string HighlightKeywords ( this string input , string keywords ) { if ( input == string . Empty || keywords == string . Empty ) { return input ; } string [] sKeywords = keywords . Split ( ' ' ); foreach ( string sKeyword in sKeywords ) { try { input = Regex . Replace ( input , sKeyword , string . Format ( "<span class=\"hit\">{0}</span>" , "$0" ), RegexOptions . IgnoreCase ); } catch { // } } return input ; } Ref : http://stackoverflow.com/questions/1629928/search-keyword-highlight-in-asp-net