[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: stringing dates
- Subject: Re: stringing dates
- From: "Foster, Carey" <CFoster@NORRELL.COM>
- Date: Fri, 7 Apr 2000 08:10:45 -0400
Paul,
You did not indicate which platform you are on, but it appears to be
non-Oracle from your dating example, perhaps DB2. If Oracle (allowing the
use of DUAL) , utilize the following - just replace the illustrated date
format with that meeting your parameters.
1. Alter you date format to include time attribute.
Begin-SQL
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'
End-SQL
2. Pull current time from sysdate and concatenate to literal date.
BEGIN-SELECT
CONCAT('04-JUL-2000', SUBSTR(SYSDATE,12,9)) &newdatetime
FROM DUAL
END-SELECT
-OR-
3. Pull current time from sysdate and concatenate to date variable.
BEGIN-SELECT
CONCAT(SUBSTR(TO_DATE($DATE1,'DD-MON-YYYY'),1,11), SUBSTR(SYSDATE,12,9))
&newdatetime
FROM DUAL
END-SELECT
4. When completed, you can reset your NLS_DATE_FORMAT.
Begin-SQL
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY'
End-SQL
Of course, this is just one example. I am sure there are many ways to
accommodate your dating needs.
Carey
----------
From: Paul Schattling [SMTP:P.Schattling@MAILBOX.GU.EDU.AU]
Sent: Friday, April 07, 2000 1:54 AM
Subject: stringing dates
Hi all,
Any ideas on how you string (merge) two date fields together?
I have a date field which only the DD-MM-YY values are populated and
I want
to add the current sysdate HH24:MI:SS to it so I end up with a
distinct
date value of DD/MM/YY HH24:MI:SS for my field.
Cheers,
Paul Schattling