<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" width="40px" /> The example database below uses timestamp and fromTimestamp() to take in a date and return a different, semi-randomized date. Note: The “randomness” of this formula is very poor, as the formula has intentionally been kept simple so it can be easily understood. Notion also does not provide any true randomness functions.

Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter

</aside>

Date Randomizer

// Compressed
if(minute(prop("Edited")) % 2 == 0, fromTimestamp(timestamp(prop("Date")) + toNumber(slice(replaceAll(id(), "\\\\D", ""), (timestamp(prop("Edited")) + 956348) % 7 - 3, 13))), fromTimestamp(timestamp(prop("Date")) - toNumber(slice(replaceAll(id(), "\\\\D", ""), (timestamp(prop("Edited")) + 891327) % 7 - 3, 13))))

// Edited
if(
    minute(
        prop("Edited")
    ) % 2 == 0,
    fromTimestamp(
        timestamp(
            prop("Date")
        ) +
        toNumber(
            slice(
                replaceAll(
                    id(), 
                    "\\\\D", 
                    ""
                ), 
                (timestamp(
                    prop("Edited")
                ) + 956348) % 7 - 3, 
                13
            )
        )
    ),
    fromTimestamp(
        timestamp(
            prop("Date")
        ) -
        toNumber(
            slice(
                replaceAll(
                    id(), 
                    "\\\\D", 
                    ""
                ), 
                (timestamp(
                    prop("Edited")
                ) + 891327) % 7 - 3, 
                13
            )
        )
    )
)

© Thomas Frank