-- test ad_to_bs function SELECT ad_to_bs('2001-02-01'::date); ad_to_bs ------------ 2057-10-19 (1 row) SELECT ad_to_bs('1972-02-17'); ad_to_bs ------------ 2028-11-05 (1 row) SELECT ad_to_bs('04-24-2026'); ad_to_bs ------------ 2083-01-11 (1 row) SELECT AD_TO_BS('1968-10-7'); ad_to_bs ------------ 2025-06-22 (1 row) -- test bs_date explicit cast operations SELECT '2057/10/19'::bs_date; bs_date ------------ 2057-10-19 (1 row) SELECT CAST('2057/10/19' as bs_date); bs_date ------------ 2057-10-19 (1 row) -- test cast round trip select ('2057/10/19'::bs_date)::text; text ------------ 2057-10-19 (1 row) select ('2057/10/19'::bs_date)::bs_date; bs_date ------------ 2057-10-19 (1 row) -- test to_char function overload for bs_date SELECT to_char('2057/10/19'::bs_date, 'YYYY-MM-DD'); to_char ------------ 2057-10-19 (1 row) SELECT to_char('2057/10/19'::bs_date, 'DD/MM/YYYY'); to_char ------------ 19/10/2057 (1 row) SELECT to_char('2057/10/19'::bs_date, 'MM-DD-YY'); to_char ---------- 10-19-57 (1 row) SELECT to_char('2057/10/19'::bs_date, 'Month DD, YYYY'); to_char --------------- Magh 19, 2057 (1 row) SELECT to_char('2057/10/19'::bs_date, 'Mon DD, YY'); to_char ------------ Mag 19, 57 (1 row) SELECT to_char('2057/10/19'::bs_date, 'Day, DD Month YYYY'); to_char ------------------------ Thursday, 19 Magh 2057 (1 row) SELECT to_char('2057/10/19'::bs_date, 'Dy, DD Mon YY'); to_char ---------------- Thu, 19 Mag 57 (1 row) SELECT to_char('2057/10/19'::bs_date, 'MONTH'); to_char --------- MAGH (1 row) SELECT to_char('2057/10/19'::bs_date, 'month'); to_char --------- magh (1 row) SELECT to_char('2057/10/19'::bs_date, 'MON'); to_char --------- MAG (1 row) SELECT to_char('2057/10/19'::bs_date, 'mon'); to_char --------- mag (1 row) SELECT to_char('2057/10/19'::bs_date, 'DAY'); to_char ---------- THURSDAY (1 row) SELECT to_char('2057/10/19'::bs_date, 'day'); to_char ---------- thursday (1 row) SELECT to_char('2057/10/19'::bs_date, 'YYYY-MM-DD', 'dev'); to_char ------------ २०५७-१०-१९ (1 row) SELECT to_char('2057/10/19'::bs_date, 'Day, DD Month YYYY', 'dev'); to_char ---------------------- बिहीबार, १९ माघ २०५७ (1 row) SELECT to_char('2057/10/19'::bs_date, 'Dy, DD Mon YY', 'dev'); to_char ----------------- बिही, १९ माघ ५७ (1 row) SELECT to_char('2057/10/19'::bs_date, 'DD/MM/YYYY', 'dev'); to_char ------------ १९/१०/२०५७ (1 row) SELECT to_char('2057/10/19'::bs_date, 'Date: Day, DD Month, YYYY'); to_char ------------------------------- Date: Thursday, 19 Magh, 2057 (1 row) SELECT to_char('2057/10/19'::bs_date, 'मिति: Day, DD Month, YYYY', 'dev'); to_char ----------------------------- मिति: बिहीबार, १९ माघ, २०५७ (1 row) -- test current_bs_date (just check if it returns a valid bs_date type) -- current_bs_date cannot be tested with pg_regress because it is not deterministic SELECT pg_typeof(current_bs_date()); pg_typeof ----------- bs_date (1 row)