Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-645

Replace AsDateTime with ToLocalTime and ToUniversalTime in BsonValue (and related changes)

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8
    • Affects Version/s: 1.7
    • Component/s: None
    • None

      Most of the AsXyz properties in BsonValue are simple casts that don't do any real conversion between types. But the AsDateTime and related properties actually do a type conversion because BsonDateTime and DateTime have different ranges and resolutions, as well the question of whether to convert to local or universal time.

      The following changes will be made:

      Deprecate AsDateTime: use ToLocalTime or ToUniversalTime instead
      Deprecate AsNullableDateTime: use ToNullableLocalTime or ToNullableUniversalTime instead
      Deprecate AsUniversalTime: use ToUniversalTime instead
      Deprecate IsDateTime: use IsValidDateTime instead (aligns with property of the same name in BsonDateTime)

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: