> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xray.cool/llms.txt
> Use this file to discover all available pages before exploring further.

# now

> `now`函数主要是用来返回当前的时间，返回类型为Timestamp

## 函数原型

`func now() Timestamp`

### 参数介绍

| 参数名称 | 参数介绍 |
| - | - |
| `Timestamp` | 这是now()函数返回的数据的数据类型，实际返回的是`Timestamp(google.protobuf.Timestamp)`类型 |

## 举例

| 语句 | 输出结果 |
| - | - |
| `now()` | `2023-01-29 16:02:38.536301 +0800 CST m=+0.978455126` |
| `int(now())` | `1674979358` |
| `string(now())` | `2023-01-29T16:02:38.536301+08:00` |
| `type(now())` | `google.protobuf.Timestamp` |

> now()返回的值如果直接输出，则是遵循`2006-01-02 15:04:05.999999999 -0700 MST`的格式进行输出
> 其中的m=+0.978455126代表的是相对于程序启动时的时间，这个时间点距离程序启动时间已经过去了0.978455126秒。
> 可以理解为程序从开始执行到触发time.now()一共使用的时间，正常情况下可以不用理会


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.