std.integer2time

TIMEstd.integer2timeINTEGERtime

Available inall subroutines.

Converts an integer, representing seconds since the Unix Epoch, to a time variable.

If the time argument is invalid then this returns a time value that stringifies to datetime out of bounds.

To convert a string, use std.time instead.

Example

declare local var.once TIME;
set var.once = std.integer2time(1136239445);
# var.once now represents "Mon, 02 Jan 2006 22:04:05 GMT"

Try it out

std.integer2time is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Convert timestamps to relative times like '2 hours ago'

Generate relative time datelines at the Edge instead of in the browser or at origin. Better caching, faster rendering, fewer reflows.

Authenticate JSON Web Tokens at the edge

Decode the popular JWT format to verify user session tokens before forwarding trusted authentication data to your origin.

Format time expressions

Format dates and times in a variety of ways.