Table of Contents

Class DateHelper

Namespace
Dynamicweb.Core.Helpers
Assembly
Dynamicweb.Core.dll

Class Dates contains date formatting strings and methods.

public sealed class DateHelper
Inheritance
DateHelper
Inherited Members

Examples

using Dynamicweb.Core.Helpers;
using System;
using System.Globalization;

namespace Dynamicweb.Core.Examples
{
    public class DateHelperSample
    {
        public void FormatStringSample()
        {
            string dateFormatting = DateHelper.DateOnlyFormatStringSortable; //"yyyy-MM-dd"
            DateTime someDate = new DateTime(2016, 09, 05,15, 46, 0);
            string formattedDate = someDate.ToString(dateFormatting, CultureInfo.InvariantCulture); //"2016-09-05"
        }
    }
}

Fields

DateFormatString

Returns a string for String.Format: "ddd, dd MMM yyyy HH':'mm"

public const string DateFormatString = "ddd, dd MMM yyyy HH':'mm"

Field Value

string

DateFormatStringDayAndMonth

Returns a string for String.Format: "dd. MMM"

public const string DateFormatStringDayAndMonth = "dd. MMM"

Field Value

string

DateFormatStringFull

Returns a string for String.Format: "ddd, dd MMM yyyy HH':'mm':'ss"

public const string DateFormatStringFull = "ddd, dd MMM yyyy HH':'mm':'ss"

Field Value

string

DateFormatStringShort

Returns a string for String.Format: "dd MMM yyyy HH':'mm"

public const string DateFormatStringShort = "dd MMM yyyy HH':'mm"

Field Value

string

DateFormatStringSortable

Returns a string for String.Format: "{0:s}" resulting in SQL and sort safe date strings, i.e. "2008-03-31T16:05:07"

public const string DateFormatStringSortable = "yyyy-MM-dd HH:mm:ss"

Field Value

string

DateOnlyFormatString

Returns a string for String.Format: "ddd, dd MMM yyyy"

public const string DateOnlyFormatString = "ddd, dd MMM yyyy"

Field Value

string

DateOnlyFormatStringMedium

Returns a string for String.Format: "ddd, dd MMM yyyy"

public const string DateOnlyFormatStringMedium = "dd MMM yyyy"

Field Value

string

DateOnlyFormatStringShort

Returns a string for String.Format: "dd-mm-yyyy"

public const string DateOnlyFormatStringShort = "dd-MM-yyyy"

Field Value

string

DateOnlyFormatStringSortable

Returns a string for String.Format: "yyyy-M-dd" resulting in SQL and sort safe date strings, i.e. "2008-3-31""

public const string DateOnlyFormatStringSortable = "yyyy-MM-dd"

Field Value

string

IsoDateFormatString

Returns a string for String.Format: "yyyy-MM-ddTHH:mm"

public const string IsoDateFormatString = "yyyy-MM-ddTHH:mm"

Field Value

string

TimeOnlyFormatStringFull

Returns a string for String.Format: "hh:mm:ss"

public const string TimeOnlyFormatStringFull = "hh:mm:ss"

Field Value

string

Methods

MaxDate()

Returns the maximum DateTime value accepted by Dynamicweb (2999/12/31 23:59:59).

public static DateTime MaxDate()

Returns

DateTime

MinDate()

Returns the minimum DateTime value accepted by Dynamicweb (1900/01/01 00:00:00).

public static DateTime MinDate()

Returns

DateTime
To top