Created
September 19, 2017 06:49
-
-
Save andrewbt/066cc1deef3173351f9d6b358b93d78b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION random_time_from_year_string(y TEXT) | |
| RETURNS timestamp AS $$ | |
| select (y || '-01-01 00:00:00')::timestamp + | |
| random() * ((y || '-12-31 23:59:59')::timestamp - | |
| (y || '-01-01 00:00:00')::timestamp); | |
| $$ LANGUAGE SQL IMMUTABLE STRICT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment