Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.strptime

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.strptime
import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { strptime } = fn;

The result is a Number, which is a unix timestamp representing the date and time in {timestring}, which is expected to match the format specified in {format}.

The accepted {format} depends on your system, thus this is not portable! See the manual page of the C function strptime() for the format. Especially avoid "%c". The value of $TZ also matters.

If the {timestring} cannot be parsed with {format} zero is returned. If you do not know the format of {timestring} you can try different {format} values until you get a non-zero result.

See also strftime(). Examples:

:echo strptime("%Y %b %d %X", "1997 Apr 27 11:49:23")

862156163

:echo strftime("%c", strptime("%y%m%d %T", "970427 11:53:55"))

Sun Apr 27 11:53:55 1997

:echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600)

Sun Apr 27 12:53:55 1997

Can also be used as a method:

GetFormat()->strptime(timestring)

Not available on all systems. To check use:

:if exists("*strptime")

Parameters

denops: Denops
format: unknown
timestring: unknown

Returns

Promise<number>