The project is in a healthy, maintained state
Adds strftime_roulette method to Date and Time classes, returning randomly formatted date/time strings
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0
 Project Readme

strftime_roulette

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

  1. Annoying your coworkers
  2. Testing if your UI handles various date formats gracefully
  3. Adding chaos to your development environment
  4. 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