Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> will this date formatting work?

will this date formatting work?

From: Analysis&Solutions <info_at_analysisandsolutions.com>
Date: Fri, 31 Oct 2003 15:31:24 +0000 (UTC)
Message-ID: <bntv8c$fnd$1@reader2.panix.com>


Hi Folks:

I'm developing a PHP application that needs to operate under a wide variety of DBMS's. I have no Oracle experience and recently learned that Oracle date columns store the entire date and time. My system has been designed with the SQL-99 standard format of YYYY-MM-DD in mind. So, I think I've come up with a plan to make things work. I'd love your feedback, please...

THE TABLE



CREATE TABLE STP_SystemDate (
  SystemDate date default '0001-01-01' NOT NULL );

WHEN MY APPLICATION STARTS, ISSUE THE FOLLOWING QUERY



ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'; DURING APPLICATION EXECUTION, THE FOLLOWING QUERIES WILL BE USED

UPDATE STP_SystemDate SET SystemDate = '2003-10-30';

SELECT SystemDate FROM STP_SystemDate;

The result of this last query will be placed in one of my application's variables, which can then be examined to find the value of "2003-10-30"

So, this will work, right?

Thanks,

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409
Received on Fri Oct 31 2003 - 09:31:24 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US