Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Date Compare

Posted on February 25, 2013October 26, 2015 By David Kittell
<%@ Page Language="C#" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<script runat="server">

	protected void Button1_Click(object sender, EventArgs e)
	{
		DateTime date1 = Convert.ToDateTime(TextBox1.Text);
		DateTime date2 = new DateTime(DateTime.Now.Year - 1, 12, 18);
		// See http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx for DateTime Help

		int nResult = DateTime.Compare(date1, date2);

		if (nResult < 0)
		{
			result.InnerHtml = "Is earlier than";
		}
		else if (nResult == 0)
		{
			result.InnerHtml = "Is the same time as";
		}
		else
		{
			result.InnerHtml = "Is later than";
		}
	}
</script>
<form runat="server">
	<asp:textbox id="TextBox1" runat="server"></asp:textbox>
	<asp:button id="Button1" runat="server" text="Test" onclick="Button1_Click" />
	<div id="result" runat="server"></div>
</form>
Originally Posted on February 25, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code CSharp

Post navigation

Previous post
Next post

Related Posts

Mac OSX Terminal – Get Stored Wireless (Wi-Fi) Password

Posted on January 18, 2017June 6, 2025

Addition to Find & Scan Wireless Networks the additional line will require a password but then display the stored password for the defined router name. # List all Wi-Fi – Older macOS /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s # Newer macOS networksetup -listpreferredwirelessnetworks en0 # Get Stored Password To Wi-Fi security find-generic-password -ga "Router_Name"…

Read More

BASH – Find all files with tab in the text

Posted on October 19, 2021August 17, 2024

grep -rnw . -e ‘\t’ // -r or -R is recursive, // -n is line number, and // -w stands for match the whole word. // -l (lower-case L) can be added to just give the file name of matching files. // -e is the pattern used during the search…

Read More

MSSQL Get Domain From Email Address

Posted on October 19, 2018

SELECT DISTINCT RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) Domain FROM contacts SELECT RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) Domain, COUNT(Email) EmailCount FROM contacts WHERE LEN(Email) > 0 GROUP BY RIGHT(Email, LEN(Email) – CHARINDEX(‘@’, email)) ORDER BY EmailCount DESC, Domain Reference: https://blog.sqlauthority.com/2011/06/18/sql-server-selecting-domain-from-email-address/ All information on this site is shared with the intention to…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes