# parsing epoch timestamp to date

To get current unix timestamp we can do

```
$ date +%s
1471365644
```

But how do we parse a file which contain epoch timestamp to date?

```
$ echo 1471365644 | perl -pe 's/(\d+)/localtime($1)/e'
```

if we have it in milliseconds, we could remove the milliseconds part with

```
$ echo 1471365644000 | cut -c -10 |  perl -pe 's/(\d+)/localtime($1)/e'
Tue Aug 16 18:40:44 2016
```

Assuming your epoch seconds is 10 character. But if you have more or less, you need to do some other string processing first


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.yulrizka.com/unix/parsing-epoch-timestamp-to-date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
