License Public Domain
Lines 4
Average
n/a
Rated
0
Times
5
4
3
2
1
0
Keywords
atom (2) atom feed (2) RFC 3339 (2) sitemap (2)
Permissions
Owner: Stou S.
Viewable by Everyone
Editable by All Siafoo Users

PostgreSQL internet date function Atom Feed

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
# '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