Adding milliseconds to long date format (tzntstmpl)
I have a date field called START_DATE defined as type TZNTSTMPL (long date/time format - YYYYMMDDHHMMSS.mmmuuun) and another field call MILLISECONDS also defined as type TZNTSTMPL.
I want to subtract 625 milliseconds from START_DATE, so I put .625 in the MILLISECONDS field and subtract MILLISECONDS from START_DATE.
The starting value in START_DATE is "20090701095000.5410000". After I subtract MILLISECONDS from START_DATE the result is "20090701094999.9160000".
The result should have been "20090701094959.9160000. The problem is with SS (Seconds) 99 is invalid.
How can I get it to subtract correctly?
Are there any ADD or SUBTRACT functions that work with the long date/time format?
Regards,
Mike...
Vindo,
Thanks that is exactly what I was looking for. It handled the adding and subtract from the long date format correctly.
Regards,
Mike...
Similar Messages
-
Long Date Format in Crystal Reports
Good evening Crystal Reports Experts:
I have the following trouble, when displaying the long date format ex. 1, March, 1999, my print layout requires that all the format is written in caps, but i have been unable to manipulate the month of the date in order that instead of March the print layout would display MARCH.
If anyone could help me to manage that all letters of the month read in CAPS i would appreciate it very much.
Thank in advance.The following formula should work for you...
UPPERCASE(ToText({TableName.FieldName}, "d, MMMM, yyyy"))
It's Don's suggestion... Without the searching.
HTH,
Jason -
[b]Adding millisecond to a date[/b]
Hi,
I am creating a view out of a table and one of the view column is based on two table columns: one is a date/time column and the other is an integer column(containing milliseconds) in the table.
My question is, how do i add the milliseconds to the date.
i tried using Date + Interval, but the interval only takes seconds.
Please note that the integer column containing milliseconds could be greater than 1000.
Thanks,
VasuYou'll have to modify this expression to cope with >= 1000 milliseconds.
SQL> select cast (sysdate as timestamp) + cast ('0 00:00:00.' || millis as interval day to second) from (select 572 millis from dual);
CAST(SYSDATEASTIMESTAMP)+CAST('000:00:00.'||MILLISASINTERVALDAYTOSECOND)
02-AUG-03 10.47.01.572000000 AM
d. -
Converting from milliseconds to a date format in java
This so that, that date can be inserted into a date column in mysql
What I have is something like 1119193190
I do:
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
Date resultdate = new Date(yourmilliseconds);
System.out.println(sdf.format(resultdate));
and Java gives me something like:
Jul 04,2004 14:06
But Java then when inserting into a mysql table is all like um....no:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect date value: 'Jul 04,2004 14:06' for column 'prodDate' at row 1
proDate is of type date in mysql.
Help?jverd wrote:
"Jul 04,2004 14:06" is a String, not a Date.
PreparedStatement ps = conn.prepareStatement("insert into T(name, birthdate) values(?, ?)");
ps.setString(1, "Joe Smith");
java.sql.Date date = new java.sql.Date(yourmillis);
ps.setDate(2, date);
ps.executeUpdate();
I am a bit confused
This i what I have
for(int i = 0; i < productions.size(); i++)
//Create a new Production from the ArrayList
Production p = (Production) productions.get(i);
//Convert the date from milliseconds to YYYY-MM-DD format. for mysql?
SimpleDateFormat dateFormatter = new SimpleDateFormat("MMM dd,yyyy HH:mm");
Date convertedDate = new Date(p.getDate());
//Build a query to insert the Production into the table
String insertQuery = "INSERT INTO WELL_PROD VALUES(" +
"'" + p.getLocation() + "'," +
"'" + dateFormatter.format(convertedDate) + "'," +
"'" + p.getOilProd() + "'," +
"'" + p.getWaterProd() + "'," +
"'" + p.getGasProd() + "')";
//Print the query to the screen
System.out.println("-> INSERTING the following query into well_prod: ");
System.out.println(" " + insertQuery);
//Update the database using the constructed query
int result = statement.executeUpdate(insertQuery);
//Print out the result of the insertion
System.out.println(" INSERT RESULT: " + result);
}Are you saying something like
java.sql.Date date = new java.sql.Date(Something , what I have no idea, Should go here);
instead of
SimpleDateFormat dateFormatter = new SimpleDateFormat("MMM dd,yyyy HH:mm");
and then carry on as normal?
If so, what should go in those brackets based on the code?
java.sql.Date date = new java.sql.Date("MMM dd,yyyy HH:mm");
This is all being read in from a text file and converted over before being spit out to the data base, it all works except for the date... -
( Urgent ) Date Formatting
I want to know how to get a date value with Milliseconds by using Date Format or any.
For Eg: I am having a LOG( Transactions) table wherein I have a date_create column of a DATE Datatype.
I want to get( Display or retrieve) the value in Milliseconds after formatting. Is there anyway out.
Does ORACLE provide that..
Thanks in Advance for your Response..
null2 solutions:
1) write a java stored procedure. java has time functionality
that is much more granular then the Oracle DATE type. This will
work in 8.1.5 and up. It can look like this:
[email protected]> CREATE or replace JAVA SOURCE
2 NAMED "MyTimestamp"
3 AS
4 import java.lang.String;
5 import java.sql.Timestamp;
6
7 public class MyTimestamp
8 {
9 public static String getTimestamp()
10 {
11 return (new
12 Timestamp(System.currentTimeMillis())).toString();
13 }
14 };
15 /
Java created.
[email protected]> create or replace function my_timestamp
return varchar2
2 AS LANGUAGE JAVA
3 NAME 'MyTimestamp.getTimestamp() return java.lang.String';
4 /
Function created.
[email protected]> l
1* select my_timestamp, to_char(sysdate,'yyyy-mm-dd
hh24:mi:ss') from dual
[email protected]> /
MY_TIMESTAMP
TO_CHAR(SYSDATE,'YY
2000-06-22 13:47:53.376
2000-06-22 13:47:53
[email protected]>
2) use an external procedure written in C. C has api's to the
system that allow for much more granular time components. This
will work in 8.0 and up. For example if you run something like:
[email protected]> create or replace library timelib as
2 '/export/home/tkyte/src/t/extproc.so'
3 /
Library created.
[email protected]> create or replace
2 procedure get_extended_time( p_timestring out varchar2 )
3 is external
4 name "get_extended_time"
5 library timelib
6 language C
7 with context
8 parameters ( CONTEXT,
9 p_timestring STRING,
10 p_timestring INDICATOR short,
11 p_timestring MAXLEN int,
12 p_timestring LENGTH int );
13
14 /
Procedure created.
[email protected]> declare
2 l_timestring varchar2(30);
3 begin
4 get_extended_time( l_timestring );
5 dbms_output.put_line(
to_char( sysdate, 'mm/dd/yy hh24:mi:ss' ) );
6 dbms_output.put_line( l_timestring );
7 end;
8 /
06/22/00 13:26:28
06/22/00 13:26:28.103243
PL/SQL procedure successfully completed.
In sqlplus after compiling the following C code into a .so or
.dll or .sl (depending on platform) you can get the
milliseconds.
Here is the C code:
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#ifndef OCI_ORACLE
# include <oci.h>
#endif
#define raise_application_error return raise_application_error_x
static long raise_application_error_x( OCIExtProcContext * ctx,
int errCode,
char * errMsg, ...)
char msg[8192];
va_list ap;
va_start(ap,errMsg);
vsprintf( msg, errMsg, ap );
va_end(ap);
OCIExtProcRaiseExcpWithMsg(ctx,errCode,msg,strlen(msg));
return -1;
long
get_extended_time( OCIExtProcContext * ctx,
char * p_data,
short * p_data_i,
int * p_data_maxl,
int * p_data_l )
struct timeval tp;
if ( *p_data_maxl < 25 )
raise_application_error( ctx, 20001,
"String must be 25 bytes or more" );
gettimeofday(&tp, NULL);
cftime( p_data, "%D %T", &tp.tv_sec );
sprintf( p_data+strlen(p_data), ".%d", tp.tv_usec );
*p_data_l = strlen(p_data);
*p_data_i = 0;
return 0;
null -
Validate long date in javascript & OnSubmit problem
hi i need to validate long date format "E, dd MMM yyyy HH:mm:ss" or Thu, 18 Jul 2002 12:52:49 that is key in by the user. but i'm not sure how to do this. i have couples of input data and i'm passing an object to the javascript function validateform using OnSubmit. Which one is better, using OnSubmit or OnCick for this kind of parameter passing. Eg <form method="POST" action="insert.jsp" onSubmit="return validateForm(this)"> However i'm having a problem where when there is an invalid input from the user, it will notify the user but it will also send the form to the insert.jsp at the same time. Therefore the user can't correct the invalid data. The function return false for valid input and true for invalid. Please help!!! urgent.... thanks in advance
Your problem is you have used
<input type="submit" onClick="OnSubmit();">
this won't work.
Instead try
<input type="button" value="someValue" onClick="OnSubmit();">
This may help. All the best. -
Help! How do I get Lion Address Book to accommodate "yyyy-mm-dd" date format?
Nor does Lion appear to accurately insert "long" date format in Word 2011.
Although long date format appears correctly in Language & Text Preferences, when inserted in Word the year inserts only the last two digits of year, e.g., July 27, 11 -- should be July 27, 2011. -
Java Scheduler - Illegal date format: Unparseable date:
Hi,
I'm trying to use JobBeans as described in http://help.sap.com/saphelp_nwce711core/helpdata/en/44/3b022e36634a8fe10000000a1553f6/content.htm and have a Date parameter to pass in from the Java Scheduler.
My job definition file looks like:
<job-definitions>
<job-definition name="SetAgreementsExpiredJob" description="Updates status of expired agreements">
<job-definition-parameter name="AgreementDate" data-type="Date" direction="IN"/>
</job-definition>
</job-definitions>
When its deployed, I schedule the job to run, but as I hit finish (to schedule it) I get an error:
The task was not added due to:Illegal date format: Unparseable date: "2010-09-03"
The date I'm selecting is from the date picker on the Set Properties page. Any ideas on why this happens?
Cheers,
Russ.Well, for 720 the fix is in the 720 SP4, which is planned to be available soon.
If you would like more details on the fix or a way to get this fix in your SP level, please open a CSN message in component BC-JAS-BTC.
-Vladislav -
How can I change the date format in Finder??
Now the dates appear like : November 15, 2005
I want 11/15/05 or maybe 11/15/2005
Or is this one of those many areas where someone at Apple decided they should tell us how our finder looks. Does anyone know if change the country setting from US to some other country would do this?This gets stranger.
I changed the long date format to: mm/dd/yyyy
(for example: 11/17/2005) and most of the date formats did change, Except that I have a comma after the date I can't get rid of. And the "date created" column when I display my desktop is using the full date. all other dates are in the long format I specified.
The dates feature is flawed as well as poorly designed. I as a user should be able to specify how I want dates displayed without having to change global settings which can screw up other things. -
Why can't I change the date format in my documents?
Good Morning. I submitted this question yesterday to the iMac forum but no one could help me. It should be a very simple thing to do but it escapes me.
Using 'Insert Date' brings up the long date format i.e. Tuesday April 16 2013. I prefer the short format 16.04.13.
I have tried to change this by going through the procedure System Preferences > Date Time. The default format in that window is the one I want but it does not appear in my Pages or Numbers documents. I then tried Systems Preferences > language and Text > Region > Customise I made sure I was in the correct region and selected the short date format. Still get the long format in the documents. I can edit this on the fly by right clicking the date but the next time I use 'insert date' it reverts to the long format. Now I'm the first to admit I am probably missing something really simple but could somebody plesae point out to me what it is 'cos it's driving me mad.
WilfHi Wilfred,
Three issues here.
1. Setting the short and long dates in System Preferences. See fruhulda's answer: Copy and paste to shift the dates position. [Nice one, fruhulda!]
2. Locking those changes in (restart your computer). See Jerry's first answer.
3. However I do not get that window that you show where it saysset to today and gives you those options which you can tick. This has nothing to do with System Preferences. That window is what you get in Pages when you double-click or right-click or Control-click the date object to bring up the options. See Jerry's last answer.
If I could try everyones patience a bit further.
No worries mate.
Regards, Ian. -
Hi
A sample web dynpro application displays information regardding Flight information with the flight date.
This application is integrated in portal too.
However, there is a requirement that end user can adjust the date format as yyyy-mm-dd or dd-mm-yyyy or mm-dd-yyyy format.
I changed these options in Windows Regional settings to different values for the short date and long date formats. Unfortunately these changes do not reflect in the iView.
Is ther any setting at the iView when developing the portal content or any other way to allow the user to see the date in the format he likes ? if yes, what needs to be done ?
Thanks
PrasadHi Prasad,
Try to use the browser locale setting instead of Windows regional setting. You can get the browser locale
setting from the below code
Locale locale = request.getServletRequest().getLocale();
Then use this locale data pattern and display date formats according to user browser locale settings.
Hope this helps.
Siva -
How to convert milliseconds to date format in sql query
Hi All,
The following code is in java.
String yourmilliseconds = "1316673707162";**
Date resultdate = new Date(Long.parseLong(yourmilliseconds));
could you plese tell me how to convert milliseconds into date format in query and comparing with another date like(sysdate-3)Hello,
http://stackoverflow.com/questions/3820179/convert-epoch-to-date-in-sqlplus-oracle
Regards -
Hi,
I am getting the following exception when i trying to insert data in to a table through a stored procedure.
oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01801: date format is too long for internal buffer
when execute this stored procedure from ana anonymous block , it gets executed successfully, but i use a OracleCallableStatement to execute the procedure i am getting this error.
Please let me know how to resolve this error.
Is this error something to do with the Database Configuration ?
Thanks & Regards
MeenalI don't know if this will help, but we were getting this error in several of the standard OA framework pages and after much pain and aggravation it was determined that visiting the Sourcing Home Page was changing the timezone. For most pages this just changed the timezone that dates were displayed in, but some had this ORA-01801 error and some others had an ORA-01830 error (date format picture ends before converting entire input string). Unfortunately, if you are not using Sourcing at your site, this probably won't help, but if you are, have a look at patch # 4519817.
Note that to get the same error, try the following query (I got this error in 9.2.0.5 and 10.1.0.3):
select to_date('10-Mar-2006', 'DD-Mon-YYYY________________________________________________HH24:MI:SS') from dual;
It appears that you can't have a date format that is longer than 68 characters. -
Formscentral - how do I change required date format to long date (e.g. January 2, 2014) in a form field? I can't seem to change it from the short date format.
Hi,
I would suggest you to change the form language to English (UK), Here are the steps:-
1. Open your form in FormsCentral
2. Clik on Options tab
3. Click on Language and Formatting and check out the selection for Form Language and make sure English (U.K.) is selected and the default date format should be day/month/year.
Regards,
Nakul -
Input Value long enough for date format ,Error in executing parallel query
Hi,
My Table: ANML( ID, STATUS,B_DATE,B_MONTH,B_YEAR, DEATH_DATE)
status 1 for alive and 2 for dead.
i wrote a view to get age.
as
create or relace view view1 as
select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
CASE
WHEN anml_age < 1
THEN 'D'
ELSE 'M'
END age_unit,
CASE
WHEN anml_age < 1
THEN TO_CHAR (daysdiff || ' Day(s)')
WHEN anml_age < 12
THEN TO_CHAR (anml_age || ' Month(s)')
WHEN MOD (anml_age, 12) = 0
THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
|| ' Year(s) '
|| MOD (anml_age, 12)
|| ' Month(s)'
END age_string
from
(SELECT a.*,
CASE WHEN status IN ( 1)
THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
END anml_age,
CASE WHEN status IN (1)
THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
END daysdiff
from (
SELECTanml.id, status,
TO_DATE ( DECODE (b_date,
NULL, 1,
b_date
|| '-'
|| DECODE (b_month,
NULL, 1,
b_month
|| '-'
|| b_year,
'dd-mm-yyyy'
) DOB,
death_date
FROM anml
WHERE b_year IS NOT NULL
) a) top
when i tried to fetch all values from view its working fine.
But when i tried to fetch values based on condition like as follows,
select * from view1 where anml_age > 20 and anml_age<30
I am getting error like:
Input Value long enough for date format and Error in executing parallel query
Please tell me wht is wrong.Here is your formatted code
create or relace view view1 as
select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
CASE
WHEN anml_age < 1
THEN 'D'
ELSE 'M'
END age_unit,
CASE
WHEN anml_age < 1
THEN TO_CHAR (daysdiff || ' Day(s)')
WHEN anml_age < 12
THEN TO_CHAR (anml_age || ' Month(s)')
WHEN MOD (anml_age, 12) = 0
THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
|| ' Year(s) '
|| MOD (anml_age, 12)
|| ' Month(s)'
END age_string
from
(SELECT a.*,
CASE WHEN status IN ( 1)
THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
END anml_age,
CASE WHEN status IN (1)
THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
WHEN death_date IS NOT NULL AND status IN (2)
THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
END daysdiff
from (
SELECTanml.id, status,
TO_DATE ( DECODE (b_date,
NULL, 1,
b_date
|| '-'
|| DECODE (b_month,
NULL, 1,
b_month
|| '-'
|| b_year,
'dd-mm-yyyy'
) DOB,
death_date
FROM anml
WHERE b_year IS NOT NULL
) a) top
Maybe you are looking for
-
Changing HD from Macbook to Pro
I have a Macbook White and just bought a Macbook Pro. I changed my Momentus XT HD of the white to the new PRO. But now I'm trying to put the 320GB HD of the Pro into the white, but is saying that I can't install the Mac OS, only in time machine mode.
-
Says it in the title
-
Wrong Partner Type in IDoc with message type REMADV
Dear all, We have created 2 IDocs, one for outbound (first in one company code) and one for inbound (receiving company code) with transaction F110 (message type REMADV, Idoc basic type PEXR2001). However, for the first outbound IDoc we have create
-
using excel 11, 08, 04 having this issue desire: when cell/hyperlink is clicked then you go to Sheet 2 cell a1. code: tell application "Microsoft Excel" make new hyperlink of active cell at active sheet with properties {address:"Sheet2!A1"} end tell
-
Signup Shield program doesn't work with FF??
I have a program "Signup Shield", which stores passwords, creates disposable email addresses and fills in forms depending on which profile you require. It is on a Scan Disc flash drive. It always starts IE when I ask it to enter details, has anyone e