Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) DateTime - Add or Subtract Seconds

Demonstrates the AddSeconds method to add or subtract a number of seconds from a date/time.

Note: This example is only valid in Chilkat v9.5.0.65 or later.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoDateTime
    Boolean iSuccess
    String sTemp1

    Get Create (RefClass(cComCkDateTime)) To hoDateTime
    If (Not(IsComObjectCreated(hoDateTime))) Begin
        Send CreateComObject of hoDateTime
    End

    Get ComSetFromCurrentSystemTime Of hoDateTime To iSuccess

    Get ComGetAsTimestamp Of hoDateTime False To sTemp1
    Showln "Current time: " sTemp1

    Get ComAddSeconds Of hoDateTime 1 To iSuccess
    Get ComGetAsTimestamp Of hoDateTime False To sTemp1
    Showln "Current time + 1 second: " sTemp1

    Get ComAddSeconds Of hoDateTime -2 To iSuccess
    Get ComGetAsTimestamp Of hoDateTime False To sTemp1
    Showln "Current time - 1 second: " sTemp1

    // Add 30 days (60 * 60 * 24 * 30)
    Get ComAddSeconds Of hoDateTime (60 * 60 * 24 * 30) To iSuccess
    Get ComGetAsTimestamp Of hoDateTime False To sTemp1
    Showln "Current time + 30 days: " sTemp1

    // Sample output for test run on 2-Dec-2016: 

    // 	Current time: 2016-12-02T12:59:13Z
    // 	Current time + 1 second: 2016-12-02T12:59:14Z
    // 	Current time - 1 second: 2016-12-02T12:59:12Z
    // 	Current time + 30 days: 2017-01-01T12:59:12Z


End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.