RE: internal date value
You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: internal date value
Igor Sorry but Oracle uses 7 bytes for a date century (1 byte) year (1 byte) month (1 byte) day (1 byte) hour (1 byte) minute (1 byte) second (1 byte) SQL desc d Name Null?Type - D DATE SQL col dump format a40 SQL select to_char(d, 'dd mon hh24:mi:ss'), dump(d) dump from d; TO_CHAR(D,'DDMON DUMP 05 may 0001 15:30:45 Typ=12 Len=7: 100,101,5,5,16,31,46 05 may 0100 15:30:45 Typ=12 Len=7: 101,100,5,5,16,31,46 05 may 0500 15:30:45 Typ=12 Len=7: 105,100,5,5,16,31,46 05 may 1000 15:30:45 Typ=12 Len=7: 110,100,5,5,16,31,46 05 may 1500 15:30:45 Typ=12 Len=7: 115,100,5,5,16,31,46 05 may 1999 15:30:45 Typ=12 Len=7: 119,199,5,5,16,31,46 05 may 2000 15:30:45 Typ=12 Len=7: 120,100,5,5,16,31,46 05 may 2100 15:30:45 Typ=12 Len=7: 121,100,5,5,16,31,46 05 may 2500 15:30:45 Typ=12 Len=7: 125,100,5,5,16,31,46 05 may 2600 15:30:45 Typ=12 Len=7: 126,100,5,5,16,31,46 05 may 2900 15:30:45 Typ=12 Len=7: 129,100,5,5,16,31,46 05 may 3000 15:30:45 Typ=12 Len=7: 130,100,5,5,16,31,46 12 rows selected. /peter Igor Neyman wrote: You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Best regards/Venlig hilsen /*Peter Gram*/ mailto:[EMAIL PROTECTED] Miracle A/S http://www.miracleas.dk/ Kratvej 2 DK - 2760 Måløv Cell: (+45) 2527 7107 Phone: (+45) 4466 8855 Fax: (+45) 4466 8856 Home: (+45) 3874 5696 Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] SQL Server Master Class 8-10 Marts, Database Forum 28-30 October Master Class 17-19 Januar 2005. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Peter Gram INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Harry, Can you explain why you need to raw internal value? Just curious. Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 1:40 PM To: Multiple recipients of list ORACLE-L You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Thomas: I'm a SAS guy who must pull Oracle data from the back-end DB. SAS stores dates internally as elapsed days since Jan 1, 1960. If I request an Oracle date field, SAS creates a datetime variable, number of seconds since midnight Jan 1, 1960. Rather than use SAS functions to extract the date ( e.g. datepart function ), I'd like to push that back to Oracle if possible and create a simple date field on SAS. I can accomplish the desired effect with: select date_fld - to_date('01Jan1960','ddmon') as sas_date but I was hoping there was an Oracle function to surface the internal value ( appears to be days since Jan 1, 1968 ). Presumably such a function would be more efficient. Thanks for your help. -Original Message- Sent: January 23, 2004 2:50 PM To: Multiple recipients of list ORACLE-L Harry, Can you explain why you need to raw internal value? Just curious. Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 1:40 PM To: Multiple recipients of list ORACLE-L You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Harry This list is moving to freelists, but I'll assume you knew that. Actually the base value for the standard Oracle dates is Jan 1, 4712 BC. There is a Julian function that will return the number of days since the base. To return the Julian, select to_char(sysdate,'J') from dual; Also, Oracle9i has some new date types and you may find one that works better for your purposes: http://otn.oracle.com/products/oracle9i/daily/may02.html Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] -Original Message- Sent: Friday, January 23, 2004 11:40 AM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: DENNIS WILLIAMS INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Oops... Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Peter Gram Sent: Friday, January 23, 2004 2:54 PM To: Multiple recipients of list ORACLE-L Igor Sorry but Oracle uses 7 bytes for a date century (1 byte) year (1 byte) month (1 byte) day (1 byte) hour (1 byte) minute (1 byte) second (1 byte) SQL desc d Name Null?Type - D DATE SQL col dump format a40 SQL select to_char(d, 'dd mon hh24:mi:ss'), dump(d) dump from d; TO_CHAR(D,'DDMON DUMP 05 may 0001 15:30:45 Typ=12 Len=7: 100,101,5,5,16,31,46 05 may 0100 15:30:45 Typ=12 Len=7: 101,100,5,5,16,31,46 05 may 0500 15:30:45 Typ=12 Len=7: 105,100,5,5,16,31,46 05 may 1000 15:30:45 Typ=12 Len=7: 110,100,5,5,16,31,46 05 may 1500 15:30:45 Typ=12 Len=7: 115,100,5,5,16,31,46 05 may 1999 15:30:45 Typ=12 Len=7: 119,199,5,5,16,31,46 05 may 2000 15:30:45 Typ=12 Len=7: 120,100,5,5,16,31,46 05 may 2100 15:30:45 Typ=12 Len=7: 121,100,5,5,16,31,46 05 may 2500 15:30:45 Typ=12 Len=7: 125,100,5,5,16,31,46 05 may 2600 15:30:45 Typ=12 Len=7: 126,100,5,5,16,31,46 05 may 2900 15:30:45 Typ=12 Len=7: 129,100,5,5,16,31,46 05 may 3000 15:30:45 Typ=12 Len=7: 130,100,5,5,16,31,46 12 rows selected. /peter Igor Neyman wrote: You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Best regards/Venlig hilsen /*Peter Gram*/ mailto:[EMAIL PROTECTED] Miracle A/S http://www.miracleas.dk/ Kratvej 2 DK - 2760 Måløv Cell: (+45) 2527 7107 Phone: (+45) 4466 8855 Fax: (+45) 4466 8856 Home: (+45) 3874 5696 Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] SQL Server Master Class 8-10 Marts, Database Forum 28-30 October Master Class 17-19 Januar 2005. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Peter Gram INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Thomas: I'm aware of the to_char function and the various options. However as you alluded to, that lands in SAS as a character literal, e.g. '22/01/2004' requiring me to convert it to internal format before I can use it in SAS. I think I have to use my work around: select date_fld - to_date('01Jan1960','ddmon') as sas_date Thanks for your time and help. -Original Message- Sent: January 23, 2004 3:32 PM To: '[EMAIL PROTECTED]' Cc: Droogendyk, Harry Harry, Look at the to_char function in Oracle. It will convert a date field to *any* format you want. for example: select to_char(date_field,'mm/dd/ hh24miss') will return a date in the format as noted. You have about as many options as you probably need. You can combine as many format and functions as you think you need. to_char translates dates to chars and to_date does the opposite - but both use the same format statements. This should work fine for you. And for you info - Oracle dates are stored internally based on a date going back many centuries - not just to 1968! Good Luck Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 3:09 PM To: Multiple recipients of list ORACLE-L Thomas: I'm a SAS guy who must pull Oracle data from the back-end DB. SAS stores dates internally as elapsed days since Jan 1, 1960. If I request an Oracle date field, SAS creates a datetime variable, number of seconds since midnight Jan 1, 1960. Rather than use SAS functions to extract the date ( e.g. datepart function ), I'd like to push that back to Oracle if possible and create a simple date field on SAS. I can accomplish the desired effect with: select date_fld - to_date('01Jan1960','ddmon') as sas_date but I was hoping there was an Oracle function to surface the internal value ( appears to be days since Jan 1, 1968 ). Presumably such a function would be more efficient. Thanks for your help. -Original Message- Sent: January 23, 2004 2:50 PM To: Multiple recipients of list ORACLE-L Harry, Can you explain why you need to raw internal value? Just curious. Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 1:40 PM To: Multiple recipients of list ORACLE-L You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET:
RE: internal date value
Thanks to all who replied with helpful comments, pointers, links etc... -Original Message- Sent: January 23, 2004 3:24 PM To: Multiple recipients of list ORACLE-L Harry This list is moving to freelists, but I'll assume you knew that. Actually the base value for the standard Oracle dates is Jan 1, 4712 BC. There is a Julian function that will return the number of days since the base. To return the Julian, select to_char(sysdate,'J') from dual; Also, Oracle9i has some new date types and you may find one that works better for your purposes: http://otn.oracle.com/products/oracle9i/daily/may02.html Dennis Williams DBA Lifetouch, Inc. [EMAIL PROTECTED] -Original Message- Sent: Friday, January 23, 2004 11:40 AM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: DENNIS WILLIAMS INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: internal date value
Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 3:09 PM To: Multiple recipients of list ORACLE-L Thomas: I'm a SAS guy who must pull Oracle data from the back-end DB. SAS stores dates internally as elapsed days since Jan 1, 1960. If I request an Oracle date field, SAS creates a datetime variable, number of seconds since midnight Jan 1, 1960. Rather than use SAS functions to extract the date ( e.g. datepart function ), I'd like to push that back to Oracle if possible and create a simple date field on SAS. I can accomplish the desired effect with: select date_fld - to_date('01Jan1960','ddmon') as sas_date but I was hoping there was an Oracle function to surface the internal value ( appears to be days since Jan 1, 1968 ). Presumably such a function would be more efficient. Thanks for your help. -Original Message- Sent: January 23, 2004 2:50 PM To: Multiple recipients of list ORACLE-L Harry, Can you explain why you need to raw internal value? Just curious. Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 1:40 PM To: Multiple recipients of list ORACLE-L You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or
RE: internal date value
Harry, Look at the to_char function in Oracle. It will convert a date field to *any* format you want. for example: select to_char(date_field,'mm/dd/ hh24miss') will return a date in the format as noted. You have about as many options as you probably need. You can combine as many format and functions as you think you need. to_char translates dates to chars and to_date does the opposite - but both use the same format statements. This should work fine for you. And for you info - Oracle dates are stored internally based on a date going back many centuries - not just to 1968! Good Luck Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 3:09 PM To: Multiple recipients of list ORACLE-L Thomas: I'm a SAS guy who must pull Oracle data from the back-end DB. SAS stores dates internally as elapsed days since Jan 1, 1960. If I request an Oracle date field, SAS creates a datetime variable, number of seconds since midnight Jan 1, 1960. Rather than use SAS functions to extract the date ( e.g. datepart function ), I'd like to push that back to Oracle if possible and create a simple date field on SAS. I can accomplish the desired effect with: select date_fld - to_date('01Jan1960','ddmon') as sas_date but I was hoping there was an Oracle function to surface the internal value ( appears to be days since Jan 1, 1968 ). Presumably such a function would be more efficient. Thanks for your help. -Original Message- Sent: January 23, 2004 2:50 PM To: Multiple recipients of list ORACLE-L Harry, Can you explain why you need to raw internal value? Just curious. Tom Mercadante Oracle Certified Professional -Original Message- Sent: Friday, January 23, 2004 1:40 PM To: Multiple recipients of list ORACLE-L You gather it wrong :) Oracle stores date in 8 bytes, one for each: year, month, day, hour, min, ... etc. Igor Neyman, OCP DBA [EMAIL PROTECTED] -Original Message- Droogendyk, Harry Sent: Friday, January 23, 2004 12:40 PM To: Multiple recipients of list ORACLE-L Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from).
internal date value
Folks: From what I gather, Oracle stores dates as the number of elapsed days since Jan 1, 1968. When I query a column of type 'DATE', it returns me the default format, dd-mon-yy. I know I can use to_char(date_col,'MMDD') etc... to define many output formats. What can I do to get the raw internal value of the date? i.e. today is 13172. Thanks. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Droogendyk, Harry INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).