> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/larky/code-examples/timestamp.md).

# Timestamp

> To try it out today, please contact us at <support@vgs.io>

## Working with Timestamp

Larky (unlike Python) does not have built-in `time()` method, as there are certain reasons for that. However, there is a solution that provides a possibility of getting the current timestamp with the help of FCO (First Class Operations) and using this value directly in Larky code.

### Larky code sample

There is an example of code below that reads the imestamp value from the `ctx` storage and writes the result into the message body.

The snippet below contains tags from the YAML in order to show how to:

* Place the piece of configuration properly in your YAML
* Combine FCO and Larky together in one route filter

```python
operations:
  - name: github.com/verygoodsecurity/common/utils/date-time/Now
    parameters:
      var: ctx.timestamp
  - name: github.com/verygoodsecurity/common/compute/larky/http/Process
    parameters:
      script: |-
        load("@stdlib//json","json")
        load("@stdlib//builtins", builtins="builtins")

        def process(input, ctx):
          body = {}
          body['timestamp'] = ctx['timestamp']
          input.body = builtins.bytes(json.dumps(body))
          return input
```

### Testing

Request to send:

```bash
curl {VAULT_URL}/post \
  -H 'Content-Type: application/json' \
  -d '{ }'
```

Response example:

```json
{
  "timestamp": "1647887942783"
}
```

### Useful links

* [YAML file export/import](/vault/developer-tools/vault-management/yaml.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/larky/code-examples/timestamp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
