# Timestamp Script

**URL:** <https://community.netbeez.net/t/timestamp-script/105>\
**Category:** APIs & Developer Support\
**Tags:** api\
**Created:** [August 23, 2023, 3:05pm UTC](https://community.netbeez.net/t/timestamp-script/105 "2023-08-23T15:05:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SebastianCoros](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@SebastianCoros](https://community.netbeez.net/u/SebastianCoros)\
**Post date:** [August 23, 2023, 3:05pm UTC](https://community.netbeez.net/t/timestamp-script/105/1 "2023-08-23T15:05:42Z")

</div>

Good afternoon team,

Hope all is well. I was wondering if you have a script that would return the data from the API with the real timestamp rather than the epoch time?

Kind Regards,  
Sebastian

---

<div class="post-metadata">

**Author:** ![panickos](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.netbeez.net/panickos/32/8_2.png) [@panickos](https://community.netbeez.net/u/panickos)\
**Post date:** [August 23, 2023, 6:42pm UTC](https://community.netbeez.net/t/timestamp-script/105/2 "2023-08-23T18:42:27Z")

</div>

Hi Sebastian,

first of all, welcome to the community! We are always happy to receive and respond to your questions.

Based on what you are asking I wrote a comprehensive guide on how to retrieve results from the API in python, using the pagination features and write them into a CSV for further processing by other tools here:

> [@Fetching Ping Results from a Specific Agent using NetBeez API into a CSV file](https://community.netbeez.net/t/fetching-ping-results-from-a-specific-agent-using-netbeez-api-into-a-csv-file/106):
>
> In this guide, we’ll demonstrate how to write a Python script to fetch all ping results from a specific agent within a given time range, using NetBeez’s API. The results will be saved in a CSV file, with each timestamp parsed into a human-readable date/time. Prerequisites Python 3.x A valid Bearer token for NetBeez’s API Installation First, install the requests library to handle HTTP requests: pip install requests Step 1: import the necessary libraries: import requests import csv import ti…

To specifically answer your question notice the line which converts the epoch timestamp in milliseconds into a human readable timestamp here:

```python
'ts': datetime.fromtimestamp(result['attributes']['ts'] / 1000).strftime('%Y-%m-%d %H:%M:%S'),

```

Let me know if you have any other questions regarding this or the API in general.

Thanks,  
Panickos
