> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
