Returns maximal from two dates. - CSharp System

CSharp examples for System:DateTime Convert

Description

Returns maximal from two dates.

Demo Code

/********************************************************************
 *  FulcrumWeb RAD Framework - Fulcrum of your business             *
 *  Copyright (c) 2002-2010 FulcrumWeb, ALL RIGHTS RESERVED         *
 *                                                                  *
 *  THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      *
 *  FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        *
 *  COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       *
 *  AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  *
 *  AND PERMISSION FROM FULCRUMWEB. CONSULT THE END USER LICENSE    *
 *  AGREEMENT FOR INFORMATION ON ADDITIONAL RESTRICTIONS.           *
 ********************************************************************/
using System.Globalization;
using System;//from w  w w  .  j a  v  a2  s. c o  m

public class Main{
        //--------------------------------------------------------------------------
    /// <summary>
    /// Returns maximal from two dates.
    /// </summary>
    /// <param name="d1">first date</param>
    /// <param name="d2">second date</param>
    /// <returns>maximal from two dates</returns>
    static public DateTime Max(DateTime d1, DateTime d2)
    {
      return (d1 > d2 ? d1 : d2);
    }
}

Related Tutorials