strftime_roulette
Because consistent date formatting is boring.
Ever looked at your app's date output and thought, "This is too predictable"? Yeah, me neither. But here we are.
strftime_roulette adds a strftime_roulette method to Date and Time objects. Every call returns a randomly formatted string. That's it. That's the gem.
Why?
No good reason. Sometimes you just want to write some code that makes you smile.
Installation
gem 'strftime_roulette'How it Works
require 'strftime_roulette'
Date.today.strftime_roulette
# => "2026-01-16 12:00:00"
Date.today.strftime_roulette
# => "January 16, 2026 12:00 AM"
Date.today.strftime_roulette
# => "01/16/2026 12:00:00"Each call picks a random format. You never know what you're gonna get.
Filter by Category
Want only date formats? Only time formats?
Time.now.strftime_roulette(:time)
# => "14:30:45"
# => "2:30 PM"
# => "14:30"
Date.today.strftime_roulette(:date)
# => "Thu Jan 16"
# => "January 16, 2026"
# => "01-16-2026"Go Atomic
Pass single: true to get output from a single strftime directive:
Date.today.strftime_roulette(:date, single: true)
# => "Thursday" # or "16" or "January" or "2026"
Time.now.strftime_roulette(:time, single: true)
# => "PM" # or "45" or "14" or "UTC"Arguments
| Argument | Values | Description |
|---|---|---|
| category | (none), :date, :time
|
Filter format type |
single: |
true/false
|
Single directive vs compound pattern |
Practical Uses
- Annoying your coworkers
- Testing if your UI handles various date formats gracefully
- Adding chaos to your development environment
- Making QA question their sanity
Available Formats
Date Patterns
-
%Y-%m-%d→ 2026-01-16 -
%m/%d/%Y→ 01/16/2026 -
%B %d, %Y→ January 16, 2026 -
%a %b %e→ Thu Jan 16 -
%d/%m/%Y→ 16/01/2026 -
%b %d '%y→ Jan 16 '26 -
%A, %B %d→ Thursday, January 16 -
%m-%d-%Y→ 01-16-2026 -
%e %b %Y→ 16 Jan 2026 -
%D→ 01/16/26
Time Patterns
-
%H:%M:%S→ 14:30:45 -
%I:%M %p→ 02:30 PM -
%H:%M→ 14:30 -
%I:%M:%S %p→ 02:30:45 PM -
%H:%M:%S %Z→ 14:30:45 UTC -
%l:%M %P→ 2:30 pm
Combined Patterns
-
%Y-%m-%d %H:%M:%S→ 2026-01-16 14:30:45 -
%D %H:%M→ 01/16/26 14:30 -
%B %d, %Y %I:%M %p→ January 16, 2026 02:30 PM -
%a %b %e %H:%M→ Thu Jan 16 14:30 -
%m/%d/%Y %H:%M:%S→ 01/16/2026 14:30:45
Single Directives
Date: %a %A %w %u %d %e %j %U %V %b %B %m %y %Y %C
Time: %S %L %s %M %H %I %k %l %p %P %Z
Disclaimer
Please do not use this in production. Unless you want to. I'm not your boss.
License
MIT
