Table of Contents

Method DateFromString

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

DateFromString(string)

Converts a string to a DateTime using the $dateFromString aggregation operator.

public static DateTime DateFromString(string dateString)

Parameters

dateString string

The string.

Returns

DateTime

A DateTime.

DateFromString(string, string)

Converts a string to a DateTime using the $dateFromString aggregation operator.

public static DateTime DateFromString(string dateString, string format)

Parameters

dateString string

The string.

format string

The format string.

Returns

DateTime

A DateTime.

DateFromString(string, string, string)

Converts a string to a DateTime using the $dateFromString aggregation operator.

public static DateTime DateFromString(string dateString, string format, string timezone)

Parameters

dateString string

The string.

format string

The format string.

timezone string

The time zone.

Returns

DateTime

A DateTime.

DateFromString(string, string, string, DateTime?, DateTime?)

Converts a string to a DateTime using the $dateFromString aggregation operator.

public static DateTime? DateFromString(string dateString, string format, string timezone, DateTime? onError, DateTime? onNull)

Parameters

dateString string

The string.

format string

The format string.

timezone string

The time zone.

onError DateTime?

The onError value.

onNull DateTime?

The onNull value.

Returns

DateTime?

A DateTime.