Skip to content

Nginx module to write `strftime` formatted time to a nginx conf variable

License

Notifications You must be signed in to change notification settings

hltbra/strftime-nginx-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx strftime module
=====================

Nginx module to write `strftime` formatted time to a nginx conf variable.

    strftime year "%Y";
    strftime date "%Y-%m-%d";
    strftime local_time "%H:%M:%S";
    strftime gmt_time "%H:%M:%S" gmt;

    location /year {
        return 200 "$year\n";
    }

    location /date {
        strftime hours "%H";
        strftime minutes "%M";
        return 200 "It's $hours hours and $minutes minutes of $date\n";
    }

    location /hour {
        return 200 "$gmt_time | $local_time of $date\n";
    }

It should output "2011" for /year, "It's 09 hours and 34 minutes of 2011-10-02" for /date, and "12:34:56 | 09:34:56 of 2011-10-02" for /hour.

About

Nginx module to write `strftime` formatted time to a nginx conf variable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages