summary refs log tree commit diff
path: root/crypto/src/asn1/cms/Time.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/Time.cs')
-rw-r--r--crypto/src/asn1/cms/Time.cs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/src/asn1/cms/Time.cs b/crypto/src/asn1/cms/Time.cs
index 89f1e4dae..67c73285b 100644
--- a/crypto/src/asn1/cms/Time.cs
+++ b/crypto/src/asn1/cms/Time.cs
@@ -35,17 +35,15 @@ namespace Org.BouncyCastle.Asn1.Cms
          */
         public Time(DateTime date)
         {
-            string d = date.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture) + "Z";
+            DateTime d = date.ToUniversalTime();
 
-			int year = int.Parse(d.Substring(0, 4));
-
-			if (year < 1950 || year > 2049)
+			if (d.Year < 1950 || d.Year > 2049)
             {
                 time = new DerGeneralizedTime(d);
             }
             else
             {
-                time = new DerUtcTime(d.Substring(2));
+                time = new DerUtcTime(d);
             }
         }