# 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: 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://docs.verygoodsecurity.com/vault/developer-tools/larky/code-examples/timestamp.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.
