X509Certificate.GetEffectiveDateString Méthode

Définition

Retourne la date d'effet de ce certificat X.509v3.

public:
 virtual System::String ^ GetEffectiveDateString();
public virtual string GetEffectiveDateString ();
abstract member GetEffectiveDateString : unit -> string
override this.GetEffectiveDateString : unit -> string
Public Overridable Function GetEffectiveDateString () As String

Retours

String

Date d'effet de ce certificat X.509.

Exemples

L’exemple suivant utilise la GetEffectiveDateString méthode pour obtenir la date d’effet d’un certificat et l’afficher dans la console.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   
   // The path to the certificate.
   String^ Certificate = "Certificate.cer";
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate );
   
   // Get the value.
   String^ results = cert->GetEffectiveDateString();
   
   // Display the value to the console.
   Console::WriteLine( results );
}

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate =  "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Get the value.
        string results = cert.GetEffectiveDateString();

        // Display the value to the console.
        Console.WriteLine(results);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Get the value.
      Dim results As String = cert.GetEffectiveDateString()
      
      ' Display the value to the console.
      Console.WriteLine(results)
   End Sub
End Class

Remarques

La date d’effet correspond à la date à laquelle le certificat X.509 est considéré comme valide.

La GetEffectiveDateString méthode retourne une chaîne qui affiche la date mise en forme dans le modèle de date courte suivie de l’heure mise en forme dans le modèle de temps long. La date et l’heure sont mises en forme à l’aide de la culture et du fuseau horaire actuels.

S’applique à