Freeside:1.7:Documentation:Dates

From Freeside
Revision as of 15:12, 15 January 2007 by Ivan (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Freeside stores most dates as "Unix time" - the number of seconds elapsed since midnight UTC on the morning of January 1, 1970, not counting leap seconds.

Conversion in Perl

  • Conversion from UNIX time: see the localtime function or the Date::Format module.
  • Conversion to UNIX time: see the Date::Parse or Time::Local modules, among others.

Conversion in PostgreSQL

  • Conversion from UNIX time (substitute in your own time zone, date field and output field name):

'epoch'::TIMESTAMP WITH TIME ZONE AT TIME ZONE 'PST' + _date_field * '1 second'::INTERVAL AS output_fieldname