@Gabrieltz , thank you for the example. We also found another configuration and wanted to share.
Special thanks to the site, calomel.org for proposing alternate solutions and explaining the following examples.
TLDR: use date,ltime() to query the system date / local time, convert the unix time integer to a date formatted string and define a named string variable with the directive, set-var .
Example 1: Query the current system date and set the two(2) digit day value to the string variable req.renew_date . The day variable “%d” is 01 through 31 . Requests going to the hostname booking.example.com and only on the 15th of the month will use the backend vacation_server.
frontend tcp_director
mode tcp
option tcplog
bind 127.0.0.1:443
default_backend server_cluster
#
# Vacation Booking, limit access to the 15th of the month and by specific hostname
tcp-request content set-var(req.renew_date) date,ltime(%d)
acl booking_date var(req.renew_date) eq 15
acl booking_sni req.ssl_sni booking.example.com
use_backend vacation_server if booking_date booking_sni
Example 2: Query the current system date and the hour setting the variable req.renew_date . The day “%d” is 01 through 31 and the hour “%H” is 00 though 23 . All requests between the local times of 8:00am and 8:59am and only on the 15th of the month will use the backend vacation_server.
frontend tcp_director
mode tcp
option tcplog
bind 127.0.0.1:443
default_backend server_cluster
#
# Vacation Booking, limit access to 8am-9am on the 15th day of the month
tcp-request content set-var(req.renew_date) date,ltime(%d%H)
acl booking_date var(req.renew_date) eq 1508
use_backend vacation_server if booking_date
Example 3: Any request, including an ssh tunneled connection through https can be limited by time of the day. Query the current system hour “%H” which results in the strings 00 though 23 set to the variable req.ssh_hour. New ssh-through-https requests going to the hostname ssh.example.com during the hours 09 through 16 (9am through 4:59pm local time) use the backend service_ssh.
frontend tcp_director
mode tcp
option tcplog
bind 127.0.0.1:443
default_backend server_cluster
#
# ssh through https tunnel, limit access between 09am-5pm local time to specific hostname
tcp-request content set-var(req.ssh_hour) date,ltime(%H)
acl ssh_hour var(req.ssh_hour) eq 09 || 10 || 11 || 12 || 13 || 14 || 15 || 16
acl ssh_sni req.ssl_sni ssh.example.com
use_backend service_ssh if ssh_hour ssh_sni
Hope this helps.