Description |
This article describes how to convert timestamps in Unix format to a readable format. When REST AP is usedI to get system time from FortiOS, it will return a large value where it represents the time in Unix format. Hence, it is necessary to convert the format to a readable format. |
Scope |
FortiOS. Windows Power Shell. |
Solution |
For example,the result from REST API is get as below using the Postman API tool:
Request URL: https://x.x.x.x:443/api/v2/monitor/system/time?access_token=xxxxxxxxxxxxxxxxxx
Results:
"http_method": "GET", "results": { "time": 1676859269 } Follow the steps below to convert the timestamp format using windows power shell:
1) Open the windows powers shell and define the parameters for Unix time:
$unix_timestamp = 1676859269
Here, the large number is the time value in Unix format.
2) Use the below command to convert the Unix time to a readable format:
Get-Date -Date ([DateTimeOffset]::FromUnixTimeSeconds($unix_timestamp)).DateTime
It is possible to see that the time is now converted to a readable format. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.