FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Jackie_T
Staff
Staff
Article Id 246436
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

 

Jackie_T_0-1676860035538.png

 

It is possible to see that the time is now converted to a readable format.

Contributors