Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q9zEG-0005aR-2B for pgsql-admin@arkaria.postgresql.org; Fri, 16 Jun 2023 02:30:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9zEE-0007N7-4Z for pgsql-admin@arkaria.postgresql.org; Fri, 16 Jun 2023 02:30:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q9zED-0007My-II for pgsql-admin@lists.postgresql.org; Fri, 16 Jun 2023 02:30:21 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q9zE6-002gH3-8P for pgsql-admin@lists.postgresql.org; Fri, 16 Jun 2023 02:30:20 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id C26B7E11DD; Fri, 16 Jun 2023 02:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1686882611; bh=jqg5cp17xQyQRfNMn7doODgroZa5iDVJGJqdqBJDY6I=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=OIAY6dSdVi+lCnaraEzJmxiU6OamJqizFn1yAxvVWz4kLb7ENyi1Cacq7xd6oAOwH +qjgK74oo2w/+xqBu2sdro3YH2k8MIl0UGbYuipfKlGBPOnBvNWeEm666G50ODuw/F /MqTFGR/YPb1hTRKaSrj2LlMPwyRPaxdgCdtWITN+GfUC4lN4ZvzneBKQ6hohm/Rny CQGSH3/YL5evdxZzzwRexb73sIbxRdK27RyNmHGHpXFgWY72KzMo33S98FrJHSmjbP IYhUv3bGq3OnMOClmEgXMsTU0yhP16D19X8HugKgjdNgRR2ThSMjHFD2k5Q4n87tC/ G+X29lBqn+I1w== X-Virus-Scanned: Debian amavisd-new at emo08-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo08-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tYiNuofDr3Qn; Fri, 16 Jun 2023 02:30:10 +0000 (UTC) Received: from smtpclient.apple (unknown [165.140.184.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 574F0E1190; Fri, 16 Jun 2023 02:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1686882610; bh=jqg5cp17xQyQRfNMn7doODgroZa5iDVJGJqdqBJDY6I=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=UBjTKBHAgDny7QvbzHGG6ZPpj4ys9X3Zqq3lc4I/tCCAT1SS99zybOgSvYnmWW51G zf/2exwdIIAKYqIK+xq+8EhDaI5x2kisCfGuLbD38o3IBve9JcvSl5L8X2lMnbp5Jt g20x4bcgo2m9SLuGIMNN8sKt5DRMT/+Ib8f4/+nIaDeSMJGTwVH6/xlojmWZcK7A6V +DNtoN91z/6xngMP0jYDESfmfMaV+QTPiaopNCHDPCTZM66O+okjXnTnUXG2IAUI7k Z3Ryqkqj1ZOfsd2kKiB8WFLBF3SpSt5tl9SNaLCDTp6cgJ7wNGwKf3LVrnvxlHDOxq Uy7+Jq/icXX5A== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: Conversion from Number to Date From: Scott Ribe In-Reply-To: Date: Thu, 15 Jun 2023 20:29:59 -0600 Cc: "pgsql-admin@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <3C2586BD-E0DC-4BAB-B791-1A789BAFFB7E@elevated-dev.com> References: To: M Sarwar X-Mailer: Apple Mail (2.3731.600.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jun 15, 2023, at 8:23 PM, M Sarwar wrote: >=20 > During the data load from CSV files to the database, the above = START_TIME and STOP_TIME date column data arrived as number value. > Now I need to translate the START_TIME and STOP_TIME back to DATE = format. Add a number to a date, you get a date that many days out. Similarly, = you can add an interval to a timestamp. So you'll need to know the base = used for those numbers, and the unit of measurement. For instance, if the numbers for date are an offset from 1970-01-01 = (Unix epoch): '1970-01-01'::date + If the numbers for time are seconds from then: '1970-01-01'::timestamptz + ' seconds'::interval Of course you'll also need to know what time zone the times are in, I = will graciously leave that as an exercise ;-) Also, the documentation page you needed: https://www.postgresql.org/docs/15/functions-datetime.html