Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.12 KB

ngxparse_http_time.md

File metadata and controls

37 lines (25 loc) · 1.12 KB

ngx.parse_http_time

语法: sec = ngx.parse_http_time(str)

内容: init_worker_by_lua, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.**

解析 http 时间字符串(比如从 ngx.http_time 返回内容)。成功情况下返回秒数,错误的输入字符格式返回 nil

 local time = ngx.parse_http_time("Thu, 18 Nov 2010 11:27:35 GMT")
 if time == nil then
     ...
 end

返回目录

English source:

ngx.parse_http_time

syntax: sec = ngx.parse_http_time(str)

context: init_worker_by_lua, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.**

Parse the http time string (as returned by ngx.http_time) into seconds. Returns the seconds or nil if the input string is in bad forms.

 local time = ngx.parse_http_time("Thu, 18 Nov 2010 11:27:35 GMT")
 if time == nil then
     ...
 end

Back to TOC