Chilkat  HOME  Android™  Classic ASP  C  C++  C#  Mono C#  .NET Core C#  C# UWP/WinRT  DataFlex  Delphi ActiveX  Delphi DLL  Visual FoxPro  Java  Lianja  MFC  Objective-C  Perl  PHP ActiveX  PHP Extension  PowerBuilder  PowerShell  PureBasic  CkPython  Chilkat2-Python  Ruby  SQL Server  Swift 2  Swift 3,4,5...  Tcl  Unicode C  Unicode C++  Visual Basic 6.0  VB.NET  VB.NET UWP/WinRT  VBScript  Xojo Plugin  Node.js  Excel  Go
| (Excel) How to Parse a TimeStamp (such as 2016-11-11T14:32:17.0908971Z)Timestamps are frequently used in REST API responses. This example demonstrates how to parse a timestamp string to get at the date/time components in the local timezone or in the GMT/UTC timezone. 
 ' Let's say we have a timestamp string such as 2016-11-11T14:32:17.0908971Z strTimestamp = "2016-11-11T14:32:17.0908971Z" Dim dateTime As Chilkat.CkDateTime Set dateTime = Chilkat.NewCkDateTime Dim success As Boolean success = dateTime.SetFromTimestamp(strTimestamp) ' Get a DtObj in the local timezone. bLocalTimezone = True Set dt = dateTime.GetDtObj(bLocalTimezone) ' Get the individual date/time components Debug.Print "-- Local Time --" Debug.Print "Year: "; dt.Year Debug.Print "Month: "; dt.Month Debug.Print "Day: "; dt.Day Debug.Print "Hour: "; dt.Hour Debug.Print "Minutes: "; dt.Minute Debug.Print "Seconds: "; dt.Second ' Get a DtObj in the GMT/UTC timezone. bLocalTimezone = False Set dt = dateTime.GetDtObj(bLocalTimezone) ' Get the individual date/time components Debug.Print "-- UTC Time --" Debug.Print "Year: "; dt.Year Debug.Print "Month: "; dt.Month Debug.Print "Day: "; dt.Day Debug.Print "Hour: "; dt.Hour Debug.Print "Minutes: "; dt.Minute Debug.Print "Seconds: "; dt.Second | ||||
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.