# FizzBuzz but time-based

Make a program that outputs the number of seconds from the beginning of today (00:00:00 of the day you run it) to the second you ran it. However, if this number is divisible by three, print Fizz instead. If it is divisible by five, print Buzz instead. If it is divisible by three and five, print FizzBuzz.

Don't pad the number printed with extra zeroes (44 instead of 00044). You don't need to take leap seconds into account (saying for the universe in which people answer this years after I post it). Standard loopholes apply, shortest program wins.

• Beginning of today as in 13th of June or Midnight of the day you run it? – Veskah Jun 13 at 15:49
• Midnight of the day you run it. – Andrew Jun 13 at 15:51
• I know you're not a new user, but I still strongly suggest using the sandbox to help iron out your challenges. The couple of days' worth of feedback is always well worth it! – Giuseppe Jun 13 at 15:52
• This is a just a composition of an existing challenge with 'get the seconds since midnight'. I don't see what that adds. – Jonathan Allan Jun 13 at 16:34
• I more intended this as a way to add a time element to FizzBuzz. I guess this adds text replacement but I dunno. – Andrew Jun 13 at 16:42

# Jelly, 26 bytes

A simple port of Dennis's "1-2-fizz-4-buzz" solution which evaluates the formatted time as seconds first

7ŒTṣ”:Vḅ60µ3,5ḍTị“¡Ṭ4“Ụp»ȯ


Try it online!

# 05AB1E, 33 30 bytes

-3 bytes from Grimy

žažbžc)60βÐ3Öi"Fizz"?}5Öi”ÒÖ”,


Try it online!

• žažbžc)60β for -3 bytes. – Grimy Jun 14 at 7:35

# Python 2, 73 bytes

import time
a=time.time()%86400//1
print(a%3<1)*"Fizz"+(a%5<1)*"Buzz"or a


Try it online!

-37 bytes using time.time instead of datetime thanks to negative seven
-4 bytes thanks to ArBo (switched to Python 2)

• 77 with time.time() – negative seven Jun 15 at 6:55
• @negativeseven oh huh, good idea. thanks! – HyperNeutrino Jun 15 at 7:24
• You can save two bytes on the print parentheses by switching to Python 2. Also, if outputting numbers with a trailing .0 is allowed, you can change int(...) to ...//1 for two more bytes. – ArBo Jun 15 at 11:54
• @ArBo Oh nice, thanks! – HyperNeutrino Jun 15 at 14:10

## Batch, 145 bytes

@set s=%time:~,8%
@set/as=((%s::=)*60+%,f=s%%3,b=s%%5,t=f+b
@for %%a in (Fizz.%f% Buzz.%b% FizzBuzz.%t%)do @if %%~xa==.0 set s=%%~na
@echo %s%


Explanation: %time% is (at least on my system) formatted hh:mm:ss.ff so we start by chopping off the fractions of seconds. Then the shortest way to do the base 60 conversion is to replace the :s with operators and evaluate, and the divisibility by 3, 5 and 15 is also calculated. This is then tested and the number of seconds replaced with the appropriate string if necessary before being printed.

# MathGolf, 24 bytes

t♪/╔%_╕Σ╠δ╕┌╠δ+Γ\35α÷ä§


Try it online!

## Explanation

t                          unix timestamp as integer milliseconds
♪/                        divide by 1000
╔%                      modulo 86400
_                     duplicate TOS
╕Σ╠δ                 Decompress "Σ╠" and capitalize to get "Fizz"
╕┌╠δ             Decompress "┌╠" and capitalize to get "Buzz"
duplicate the top two items
+           pop a, b : push(a+b)
Γ          wrap last four elements in array
\         swap top elements (swaps 2nd copy of time to TOS)
35α      push [3, 5]
÷     is divisible
ä    convert from binary
§   get from array


# PowerShell, 1179490 71 bytes

-23 bytes thanks to mazzy
-19 bytes thanks to mazzy again

[[ 0 -eq "($z%5)" ]]&&echo "buzz"||[$a -eq 1 ]&&echo||echo $z  could probably golf down last two lines... # JavaScript (Node.js), 125 120 bytes x=Date().match(/\d\d/g).slice(3,6).reduce((a,j,i)=>a+=60**(2-i)*j) console.log((x%3==0?'Fizz':'')+(x%5==0?'Buzz':'')||x)  Try it online! First line parses a date string for [hours, minutes, seconds] and adds them together, second line is just FizzBuzz. • 107 bytes (also fixes the bug that made your answer wrong in your reduce function) – Expired Data Jun 14 at 15:16 • Very nice, thanks! We don't have to put console.log in the answer? – Ian Jun 14 at 17:09 • Input/output methods are lax to a degree. Specifying a lambda is fine, so rather than outputting to a specific IO stream we just output from our function. – Expired Data Jun 14 at 17:11 # Perl 5, 74 bytes $t+=$_*60**$g++for(gmtime)[0..2];say+(($t%3==0&&Fizz).($t%5==0&&Buzz))||$t  Try it online! # Bash, 76 bytes date +'%H 60*%M+60*%S+[p]sc[[]sc[Fizz]n]sa[[]sc[Buzz]n]sbd3%0=ad5%0=blcx'|dc  Try it online! # APL (Dyalog Unicode), 40 bytesSBCS {∨/d←0=4/3 5|⍵:d/'FizzBuzz'⋄⍵}60⊥3↑3↓⎕TS  Try it online! ⎕TSTime Stamp; e.g. [2019,06,14,07,48,20,317] 3↓ drop three; e.g. [07,48,20,317] 3↑ take three; e.g. [07,48,20] 60⊥ evaluate as base-60 digits; e.g. 28100 {} apply the following anonymous lambda to that: ⍵ the argument; e.g. 28100 3 5| the division remainder when that is divided by 3 and 5; e.g. [2,0] 0= Boolean mask where that is equal to 0; e.g. [0,1] 4/ replicate those numbers for 4 copies of each; e.g. [0,0,0,0,1,1,1,1] d← assign that to d ∨/: if any of those are true (OR-reduction); e.g. true: d/'FizzBuzz' use d to mask the characters of the string; e.g. "Buzz" ⋄ else: ⍵ the argument; e.g. 28100 # AutoIt, 90 bytes $a=(@HOUR*60+@MIN)*60+@SEC
ConsoleWrite($a&(Mod($a,3)=0?"Fizz":"")&(Mod(\$a,5)=0?"Buzz":""))


It looks really bad without whitespace.

(FYI: AutoIt is a Windows basic-like scripting language)

# Pyth, 36 bytes

Js%.dZ84600|+*!%J3"Fizz"*!%J5"Buzz"J


Try it online!

Loosely based on the Python 2 answer.