Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Get Certificate Valid To/From DatesDemonstrates how to get the certificate "valid from" and "valid to" dates.
Use ChilkatAx-win32.pkg Procedure Test Handle hoCert Boolean iSuccess Variant vCkdt Handle hoCkdt Variant vDt Handle hoDt String sTemp1 Integer iTemp1 Integer iTemp2 Integer iTemp3 Integer iTemp4 Integer iTemp5 Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadFromFile Of hoCert "qa_data/certs/testCert.cer" To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End // Get the certificate valid-from date/time Get ComGetValidFromDt Of hoCert To vCkdt If (IsComObject(vCkdt)) Begin Get Create (RefClass(cComCkDateTime)) To hoCkdt Set pvComObject Of hoCkdt To vCkdt End // Get the local timestamp string. Get ComGetAsTimestamp Of hoCkdt True To sTemp1 Showln "Valid from: " sTemp1 // Valid from: 2017-03-17T19:00:00-05:00 // Now get the date/time as another object where we can get the individual numeric date parts. Get ComGetDtObj Of hoCkdt True To vDt If (IsComObject(vDt)) Begin Get Create (RefClass(cComChilkatDtObj)) To hoDt Set pvComObject Of hoDt To vDt End Get ComDay Of hoDt To iTemp1 Get ComMonth Of hoDt To iTemp2 Get ComYear Of hoDt To iTemp3 Get ComHour Of hoDt To iTemp4 Get ComMinute Of hoDt To iTemp5 Showln iTemp1 "/" iTemp2 "/" iTemp3 " " iTemp4 ":" iTemp5 Send Destroy of hoDt Send Destroy of hoCkdt // Get the certificate valid-to date/time Get ComGetValidToDt Of hoCert To vCkdt If (IsComObject(vCkdt)) Begin Get Create (RefClass(cComCkDateTime)) To hoCkdt Set pvComObject Of hoCkdt To vCkdt End Get ComGetAsTimestamp Of hoCkdt True To sTemp1 Showln "Valid to: " sTemp1 // Valid to: 2020-03-18T18:59:59-05:00 Get ComGetDtObj Of hoCkdt True To vDt If (IsComObject(vDt)) Begin Get Create (RefClass(cComChilkatDtObj)) To hoDt Set pvComObject Of hoDt To vDt End Get ComDay Of hoDt To iTemp1 Get ComMonth Of hoDt To iTemp2 Get ComYear Of hoDt To iTemp3 Get ComHour Of hoDt To iTemp4 Get ComMinute Of hoDt To iTemp5 Showln iTemp1 "/" iTemp2 "/" iTemp3 " " iTemp4 ":" iTemp5 Send Destroy of hoDt Send Destroy of hoCkdt End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.