Explain yourself with reStructured Text, embedded code, graphs, charts, and LaTeX–style math.
Join Siafoo Now
or
Learn More
PostgreSQL internet date function
| In Brief | An SQL function for converting a time zone aware timestamp into a string representing internet time (see RFC 3339) as used by Atom feeds (see RFC 4287) and sitemaps |
| Language | SQL |
# 's
1CREATE OR REPLACE FUNCTION internet_date(timestamp with time zone) RETURNS text AS $$
2 SELECT to_char($1, 'YYYY-MM-DDThh24:MI:SS') || to_char(EXTRACT(timezone_hour FROM $1), '00')
3 || ':' || trim(to_char(EXTRACT(timezone_minutes FROM $1), '00'));
4$$ LANGUAGE SQL;
An SQL function for converting a time zone aware timestamp into a string representing internet time (see RFC 3339) as used by Atom feeds (see RFC 4287) and sitemaps
Add a Comment