How to remove class after delay in jQuery

To remove class after delay in jQuery you can use one of the snippet below.

Samples

jQuery Sample using setTimeout()

Samples

jQuery Sample using delay() and queue()

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to get Hours Difference of 2 Dates in C# and VB.NET

To get Hours Difference of 2 Dates in C# and VB.NET you can use the following snippet.

Sample C#

/// <summary>
/// Returns the Hour Difference of two Datetimes as Double Value.
/// </summary>
/// <param name="dateOne">The original date.</param>
/// <param name="dateTwo">The Datei to be Checked against the Original Date.</param>
/// <returns></returns>
public static Double DifferenceInHours(this DateTime dateOne, DateTime dateTwo)
{
	return (dateOne - dateTwo).TotalHours;
}

Sample VB.NET

''' <summary>
''' Returns the Hour Difference of two Datetimes as Double Value.
''' </summary>
''' <param name="dateOne">The original date.</param>
''' <param name="dateTwo">The Datei to be Checked against the Original Date.</param>
''' <returns></returns>
<System.Runtime.CompilerServices.Extension> _
Public Shared Function DifferenceInHours(dateOne As DateTime, dateTwo As DateTime) As [Double]
	Return (dateOne - dateTwo).TotalHours
End Function

As always, this extension method has been added to the Github Fesslersoft.Extensions Repository

Please rate this snippet

How to get the Month name of a Datetime in C# and VB.NET

To get the Month name of a Datetime in C# and VB.NET you can use the following snippet.

Sample C#

Console.WriteLine(new DateTime(2010, 1, 1).ToString("MMM", CultureInfo.InvariantCulture)); //Jan
Console.WriteLine(new DateTime(2010, 1, 1).ToString("MMMM", CultureInfo.InvariantCulture)); //January

Sample VB.NET

Console.WriteLine(New DateTime(2010, 1, 1).ToString("MMM", CultureInfo.InvariantCulture))
'Jan
Console.WriteLine(New DateTime(2010, 1, 1).ToString("MMMM", CultureInfo.InvariantCulture))
'January

Please rate this snippet

How to check if Date is Workday in C# and VB.NET

To check if Date is Workday in C# and VB.NET you can use the following snippet.

Sample C#

public static bool IsWorkDay(DateTime date, bool isWorkDaySaturday)
{
	if (date == null) {  throw new ArgumentNullException("date");}
	switch (date.DayOfWeek)
	{
		case DayOfWeek.Saturday:
			return isWorkDaySaturday;
		case DayOfWeek.Sunday:
			return false;
		default:
			return true;
	}
}

Sample VB.NET

Public Shared Function IsWorkDay(date As DateTime, isWorkDaySaturday As Boolean) As Boolean
	If date Is Nothing Then
		Throw New ArgumentNullException("date")
	End If
	Select Case date.DayOfWeek
		Case DayOfWeek.Saturday
			Return isWorkDaySaturday
		Case DayOfWeek.Sunday
			Return False
		Case Else
			Return True
	End Select
End Function

Please rate this snippet

How to measure execution time of a Action in C# and VB.NET

To measure execution time of a Action in C# and VB.NET you can use the following Extension Method snippet.

Sample C#

public static TimeSpan Time(this Action @this)
{
	var watch = Stopwatch.StartNew();
	@this();
	watch.Stop();
	return watch.Elapsed;
}

Sample VB.NET

<System.Runtime.CompilerServices.Extension> _
Public Shared Function Time(this As Action) As TimeSpan
	Dim watch = Stopwatch.StartNew()
	this()
	watch.Stop()
	Return watch.Elapsed
End Function

Please rate this snippet

How to count the DOM loading time in Javascript

To count the DOM loading time in Javascript you can use the following snippet.

Sample Javascript

var dateBefore = new Date();

window.onload = function() {
document.getElementById("aDivId").innerHTML = (new Date()).getTime() - dateBefore.getTime(); 	
}

Please rate this snippet

How to calculate the number of days in a month in C# and VB.NET

To calculate the number of days in a month in C# and VB.NET.

Sample C#

private static int DayCountPerMonth(DateTime date)
{
	if (date == null) {  throw new ArgumentNullException();}
	var calendar = new System.Globalization.GregorianCalendar();
	return calendar.GetDaysInMonth(date.Year, date.Month);
}

Sample VB.NET

Private Shared Function DayCountPerMonth(date As DateTime) As Integer
	If date Is Nothing Then
		Throw New ArgumentNullException()
	End If
	Dim calendar = New System.Globalization.GregorianCalendar()
	Return calendar.GetDaysInMonth(date.Year, date.Month)
End Function

Please rate this snippet

How to select date from datetime in MSSQL

To select date from datetime in MSSQL you can use the following snippet.

Sample MSSQL

SELECT CONVERT(VARCHAR(10),Testdatecolumn,104) FROM dbo.tblTest

The 104 is for tt.mm.jjjj, a list of formats can be found at the MSDN CAST and CONVERT (Transact-SQL)

Please rate this snippet