X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DB9A1D1D120 for ; Mon, 9 Feb 2004 15:03:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66320-07 for ; Mon, 9 Feb 2004 11:03:34 -0400 (AST) Received: from mail21.nhs.uk (mail21.nhs.uk [62.6.139.215]) by svr1.postgresql.org (Postfix) with ESMTP id 0F504D1CCBE for ; Mon, 9 Feb 2004 11:03:25 -0400 (AST) Received: from [10.191.254.3] (helo=relayint1.nhs.uk) by mail21.nhs.uk with esmtp (MTC MTA) id 1AqCwg-00049N-4T for pgsql-sql@postgresql.org; Mon, 09 Feb 2004 15:03:34 +0000 Received: from relay.nhs.uk (194.62.42.141) by relayint1.nhs.uk (Syntegra-I1 7.0.008) id 3FB9F7660109492A for pgsql-sql@postgresql.org; Mon, 9 Feb 2004 15:03:33 +0000 Received: from smtp.gosh.nhs.uk (195.105.8.13) by relay.nhs.uk (Syntegra-1 7.0.008) id 40278F4C0000DE67 for pgsql-sql@postgresql.org; Mon, 9 Feb 2004 15:03:33 +0000 Received: from GATEWAYS-MTA by smtp.gosh.nhs.uk with Novell_GroupWise; Mon, 09 Feb 2004 15:03:11 +0000 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.1 Date: Mon, 09 Feb 2004 15:02:56 +0000 From: "Mark Roberts" To: Subject: timestamptz - problems Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Guinevere: 2.0.13 ; Great Ormond Street X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/83 X-Sequence-Number: 16774 Hi im using 'timestamptz' in a function called: 'getdate' to enter the start and finish time into a db field, however the date appears to be inserted into the db in a random format, i wish for it to only be entered into the db as DD-MM-YYYY (European,UK). I understand this is probably a very simple problem to resolve but thus far I have failed, can anyone plz help. ************ 'getdate' function is as follows: *************** CREATE FUNCTION getdate() RETURNS timestamptz AS ' BEGIN RETURN now(); END; ' LANGUAGE 'plpgsql'; ************ Inserted using the following function: ***************** CREATE FUNCTION newmess(int4, text, varchar) RETURNS varchar AS ' DECLARE userid ALIAS for $1; message ALIAS for $2; touser ALIAS for $3; enttime DATETIME; touserid INTEGER; rdset BIT; from VARCHAR; BEGIN rdset = 0; touserid=(select id from users where lastname=touser); enttime=(select getdate()); from=(select lastname from users where id = userid); INSERT INTO CallLog.message(message, fromuser, touser, txtime, rd, fromusern) values(message. userid, touserid, enttime, rdset, from); END; ' LANGUAGE 'plpgsql'; ********************************************************************************************************************* Kind Regards, Mark. _______________________________________ Disclaimer: Great Ormond Street Hospital for Children NHS Trust SECURITY WARNING RE: PATIENT OR OTHER CONFIDENTIAL DATA. Please note that Internet E-mail is simply not a secure communication medium. We strongly advise that you understand & observe this lack of security when e-mailing us. This email and any files transmitted with it are intended solely for the use of the individual to whom they are addressed. If you have received this email in error please notify your email administrator. Any views or opinions are solely those of the author of this email and do not represent those of Great Ormond Street Hospital for Children NHS Trust unless specifically stated. VIRUSES: This email message has been checked for the presence of computer viruses by Sophos antivirus software. However, this does not guarantee that this email is free of viruses, and the recipient should perform their own check.