Simple date arithmetic
I need to subtract date1 from date2 and show the result in HH:MI:SS format. Thanks in advance for the help and the effort.
SQL> with t as (select sysdate - 2.254656334 as date1, sysdate as date2 from dual),
2 t2 as (select numtodsinterval(date2 - date1,'DAY') int from t)
3 select int,
4 extract(DAY from int)*24+
5 extract(HOUR from int)||' hour(s) :'||
6 extract(MINUTE from int)||' minute(s) :'||
7 extract(SECOND from int)||'second(s)' diff
8 from t2
9 /
INT DIFF
+000000002 06:06:42 54 hour(s) :6 minute(s) :42second(s)
SQL>
Similar Messages
-
Dynamic Drop Down creation using simple data types
Hi all,
I have got a requirement in which i have to create an iView which is going to have 6 drop down values and with in that 1 value is going to have sub values which needs to get displayed in the similar drop down fashion.
I have created a simple data type having enumeration of the 6 values and linked the same to iView with drop down by key which is working successfully. And for the purpose of sub values i have created a similar simple data type with two values and linked the same with a value attribute.
Well, can any one tell me the further process to proceed ?
Thanks in advance ...
VipinVipin,
There are quite some steps to achieve what you need. Since you have both your DropDownByKey elements defined and bound to context elements, it may make sense to keep the Second DropDownByKey element invisible and make it visible only when user selects a specified key from first DropDownByKey. To achieve this, follow these steps.
1. Create an action with a parameter "key" of type string.
2. Bind this action with onSelect event of your First DropDownByKey UI Element.
3. Do mapping of parameter "key" in your wdDoModifyView with following code.
if (firstTime)
final IWDDropDownByKey dk = (IWDDropDownByKey)view.getElement("DropDownByKey1");
// Replace DropDownByKey1 with id of your DropDownByKey Element.
dk.mappingOfOnSelect().addSourceMapping("key", "key");
4. Create a context attribute of type WDVisibility say "DDVisible" and bind to "visible" property of your second DropDownByKey.
5. Set DDVisible to NONE in wdInit().
wdContext.currentContextElement().setDDVisible(WDVisibility.NONE);
6. In onSelect action write this code to make second visible
if(key.equalsIgnoreCase("Two")){
//Replace "Two" with your required value.
wdContext.currentContextElement().setDDVisible(WDVisibility.VISIBLE);
else{
wdContext.currentContextElement().setDDVisible(WDVisibility.NONE);
This should give the desired results.
Hope this helps.
Vishwas. -
Hi,
I have an entity object with some attributes, one of them is called "CREATED_ON", which i have specified as a history column (created on).
I have specified a format type of Simple Date in my Control hint and a format of dd-MM-yyyy. I then created a view based on my entity and dragged the view as an adf creation form. I also dragged a commit button to commit my record.
However, the date that is stored in my database have a non-zero time component (e.g. 10-JUL-2007 10:46:22). This is a problem becuase in my search form, the search criteria does not work (it requires the exact time also to work). I do not want to use TRUNC in my SQL query.
Instead i want the date to be stored with the format mask that i have specified.
Can you please help me?
Thank youDo you really want to lose the time component altogether, or just make the query on date-without-time work?
There would be no way of recovering the information about when during the day the row was created if you truncate the time information, but it's possible to achieve if that's what you want. Both are possible to achieve.
To achieve the "losing the current time info forever" approach, add the following overridden method in your entity impl class that slightly changes the way the history attribute value is returned, in my case, for the HIREDATE attribute of an Emp example:
protected Object getHistoryContextForAttribute(AttributeDefImpl attributeDefImpl) {
Object ret = super.getHistoryContextForAttribute(attributeDefImpl);
if (attributeDefImpl.getIndex() == HIREDATE) {
ret = new Date(new java.sql.Date(((Date)ret).getValue().getTime()));
return ret;
}To achieve # 2 instead, just add a SQL-derived attribute to the view object with formula:
TRUNC(HIREDATE)and then use that sql-derived attribute in the query form instead of the normal HIREDATE attribute. -
What can be considered as the business logic of simple data entry form
Hi all,
I want to separate my applications logic into layers. It is a simple data entry form and doesn't contain any complex business logic. So I want to get this simple business logic to different layer. But the problem is, I cannot clearly identify what are business logic of this kind of simple data entry form.
How do I separate business logic of this simple data entry form to another layer?
any help is appreciated,
Thanks in advance,
Dil.dcminter wrote:
It is a [form] and doesn't contain any complex business logic. So I want to get this simple business logic to different layer. But the problem is, I cannot clearly identify what are business logic of this kind of [form].Are you asking which bits are business logic?
Suppose that the data comes into your system immaculate from some external system. Imagine that it will go out into some other system. The bits that you would still have to write are your business logic.That's a nice practical definition. Thank you, I'm stealing it.
Also interesting to note that validation falls into that category... say you're recieving data from a magical external source... you still have to validate it.
And of course you'd still have to store it somewhere, ans retrieve it.
Yep, I definately like that definition.
Cheers. Keith. -
Simple Data Base Program for Mountain Lion
Does anyone have a recommendation for a simple data base program that will import comma delimited fields from early versions of Filemaker Pro (v 3.0, v5.0)
The ability to import Filemaker Templates and Layouts would be a big plus.
I do not need the a highly sophisticated program just something with the ability to import data from several different data bases and create layouts that look like I want them to look.
Also what is the earliest version of Filemaker that will run well on Mountain Lion ?
Thanks....KenI suggest Bento (by Filemaker), simple database, imports Filemaker Pro files and doesn't cost very much
-
Simple Data Type in CAF of SAP NetWeaver DevStudio 7.1 SP3
Hallo
Anybody knows about the use of Enumeration for simple Data Type in CAF of SAP NetWeaver DevStudio 7.1 SP3?
I've defined an attribute "status" for the Entity "Project" with the following values
0: NEW;
1: ACTIVE;
-1: INACTIVE.
As you see the data type is short.
In the program I want to use the following code:
Project myProject = new Project();
myProject.setStatus(Status.NEW)
But I found it out, it is inpossible to to use Status.NEW.
On the other side I read the article of https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/085098ea-0c01-0010-12a8-80ac838bec85. This article is again not updated with the version 7.1 SP 3.
I cannot understand about the whole changes. In the previous release we can define a DDIC type and use it as Simple Data type and in the new Release we just use the XSD-Facet to define an enumeration, but the problem is: we can not reference it in the program. I don't see any advantage. And I tried to find out how I can define the attibute using DDIC type. I didn't get it.
Thanks for any Hints!
Kind Regards!
PingHi Oliver,
Thanks for the reply!
I have login into the system, using User Id and Password.
I have tried unsinstalling everything but the result remains the same.
Previously only one service SAPCE_01 was showing up in the services explorer. But when I tried the
Instance 00:
sc create SAPRKT_00 binPath= "C:\usr\sap\RKT\SYS\exe\uc\NTI386\sapstartsrv.exe pf=C:/usr/sap/RKT/SYS/profile/CE1_SCS00_xxxxx" start= auto obj= "NT AUTHORITY\LocalService" password= abcd1234
Instance 01:
another service SAPCE1_00 was created. But when I tried to retry the instlattio, the installation again stopped at the point while starting the service and when I tried to retry it terminted with the following error.
Please guide.
sapinst.exe - Application Error
The instruction at "0x00cbf040" referenced memory at "0x0072006d". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program
Selfextractor error
iaextract.c:888: child has signaled an exec error. Keeping directory C:/DOCUME1/I047488/LOCALS1/Temp/sapinst_exe.1448.1196681060
OK
Manish -
Hello,
I have used Simple Date extensively and have recently found what I think may be a bug.
The API says that any string or character can be ignored in the input pattern by simply putting single quotes around it.
If I have a date in raw format as follows: 2007-07-19T08:00:00
I can use the input format yyyy-MM-dd'T'hh:mm:ss to parse this raw format above correctly. The single quotes around the T ignore this character in the parsing. This is fine.
However, now I have a new raw format I have to deal with, it appears like this: 2007-07-19 08:00:00Z
Now, SimpleDate handles the space just fine, however when I try to use this pattern, SimpleDate complains it cannot parse it.
yyyy-MM-dd hh:mm:ss'Z'
I have tried with many different characters and configurations but it seems there is a common bug here. If there is a character that is surrounded by single quotes at the END of the pattern, SimpleDate throws an exception.
My question is should I be able to add ignored text in single quotes at any point in the pattern? Or are certain areas of the pattern off limits like the very end of the pattern?
Thank you in advance for your response.
TRjverd,
Further research showed our app was running in J#. Run the command calls directly worked fine for each example. I am looking into how our app translates the text entered in the input field. Thank you for testing though.
TR -
Hi,
Can any one please tell what is simple date format for below format.
2008-11-04T11:49:04.312-04.00Basil wrote:
I think all are getting confused with my question, I dont want to know how to convert date
to a a particular format, I want to know if there is any format for 2008-11-04T11:49:04.312-04.00
like yyyy-MM-dd'T'HH:mm:ss.SSS for 2008-11-04T11:49:04.312. My JDK version is 1.4
Edited by: Basil on Nov 4, 2008 7:43 AM
Edited by: Basil on Nov 4, 2008 7:43 AMRead the link for SimpleDateFormat and make one. How is that hard to understand? And it is what you have been being told from the beginning, and would have realised had you actually read the API docs pointed to. All the information you need to do so is there. -
Issues in Simple Data Type - Float
Hi SDN,
I have created a simple data type of float and assigned to a context attribute. I have mentioned that the minimum and maximum inclusive value for the float as 0.1 and 29.9. This is assigned to a field aaa. When the page loads for the first time, there appears 0 by default and if I dont edit the field and try saving, it doesnt throw any error message. It accepts the value which was very strange to me. But if I edit the value and put as 0.0, it throws error message saying, the acceptable value for the field is between 0.1 and 29.9.
What should I do to resolve this issue? Also Can I make the field empty instead of a zero appearing the field?
Regards,
Ganesh NHello Ganesh,
Whatever the value you have provided only that values are allowed in that input field. if the value is 0 or 0.0 you can validate that attribute and throw an error message that "The Value should not be 0".
Regards
Nizamudeen SM -
Problem with central build of Simple Date Type with Enumeration
Dear gurus,
I hope I'm posting this in the correct forum. Please advise if I'm in the wrong forum.
I have a Web Dynpro DC in which I've created a simple data type with enumeration. It is used for binding to a radio box. The data type is called DownloadType; the enumeration contains two vales: current and archive. To allow me to access the enumeration values, I turn on the "Generate a class representation of the enumeration" in the data type builder.
I then reference the enumeration values with code like:
if (downloadType.equals (DownloadType._CURRENT))
yada yada yada
This works fine when building locally and deploying directly. But when the DC is built by CBS (or doing a "Development Component->Build..." in NW Dev Studio), the build fails, stating that the DownloadType._CURRENT symbol cannot be resolved.
For example:
C:yadayadayada.java:227: cannot resolve symbol
symbol : variable _CURRENT
location: class yadayadayada.DownloadType
equals(DownloadType._CURRENT)) {
Apparently the central builder is not smart enough to handle the "Generate a class representation" flag.
Is this a known problem? Are there any workarounds?
Thanks in advance for any help you can provide.
-Kelly
P.S. Environment: 2004sHi Kelly,
works for me using SP10, what SP are you on?
There's a line in the DC log that says:
[ddgen] [Info] Generating datatypes/com/x/x/x/MyEnum.java
and the java compiler includes the matching path for compilation:
[echo] source paths:
[echo] ...\_comp\src\packages
[echo] ..\t\ABF37B5AFB3B2E8A76FFD29E7862EA48\gen_ddic\datatypes
Regards,
Marc -
Hello,
I'm stuck against a simple date query and need some help. Can anyone please shed some light on this?
Our Environment is: oracle 8i and SYsdate format is: GMT.
I have a table say employee with the following fields;
Employee_id,employee_name,hire_date,is_new
I have to find:
Select employee_name
From employee
Where is_new = Y
And hire_date between (00 GMT) and now.
So, my problem is:
How do I do the AND Clause?
How can I get between 00GMT of today and now.
Any help will greatly be appreciated. THanks in advance
simakYou could also use
Select employee_name
From employee
Where is_new = Y
And hire_date >= trunc(sysdate); -
Help with simple date formatter
hi i have a text box which has a date , day , time on it, i would like to use simple date formatter and change the format...
i would like to get the day part alone getin displayed below the text box,
any suggestions?Yes. Read the SimpleDateFormat API docs about specifying formatting patterns.
-
First off, its been years since I've written any code and that was 1st and 2nd year college programming classes with Visual Basic 6 (I still have the install CDs). So basically I remember only concepts of IF THEN ELSE, etc not the nuts and bolts of
writing the code :)
I am wanting to create a simple data collector for my photography business. I want the students to enter their names and emails into forms and the app to enter the info into an excel spreadsheet. When the student hits enter, the app prints a page with their
name in large letters which I include in their first shot (so later I can put a face with a name)
I have created a form that has the visual look of my desired app, I need help with the nuts and bolts...
Thanks so much for any help... TomTom,
When I'm done with this I'll zip up the project folder and upload it for you (if you want me to). That will be easier that copy/paste.
I have a start on it and a preliminary test so that you can see what I have here. I have namespace called "Student" and some classes in that namespace as shown on a
page of my website here.
The way that I have it set up, the parent's e-mail(s) is optional. If you want it to be mandatory I can make it that way, but you might want to re-think that - not all parents will have one. Anyway, the following shows my first test:
Option Strict On
Option Explicit On
Option Infer Off
Public Class Form1
Private studentList As New List(Of Students.StudentData)
Private Sub Form1_Load(sender As System.Object, _
e As System.EventArgs) _
Handles MyBase.Load
' Test it here
Try
Students.StudentData.AddNewStudent(studentList, _
"Frank", _
"Smith", _
Students.StudentData.StudentLevel.Senior, _
"[email protected]")
' Uncomment the following out and it will
' throw an exception about the e-mail being
' a duplicate:
'Students.StudentData.AddNewStudent(studentList, _
' "John", _
' "Doe", _
' Students.StudentData.StudentLevel.Graduate, _
' "[email protected]")
Students.StudentData.AddNewStudent(studentList, _
"Mary", _
"Jones", _
Students.StudentData.StudentLevel.UnderGrad, _
"[email protected]")
Students.StudentData.AddNewStudent(studentList, _
"Jim", _
"Anderson", _
Students.StudentData.StudentLevel.UnderGrad, _
"[email protected]", New String() _
{"[email protected]", _
"[email protected]"})
Students.StudentData.ExportToEncryptedXML(studentList)
Students.StudentData.ImportFromEncryptedXML(studentList)
Stop
Catch ex As Exception
MessageBox.Show(String.Format("An error occurred:{0}{0}{1}", _
vbCrLf, ex.Message), _
"Program Error", MessageBoxButtons.OK, _
MessageBoxIcon.Warning)
End Try
End Sub
End Class
The XML file is saved into the program's Application Data folder which one of the classes automatically creates for you. Even if that were to be discovered, it wouldn't do anyone a lot of good.
This is what they'd find based on the data entered as shown above in my test.
Tell me your thoughts of this so far please?
Still lost in code, just at a little higher level. -
Simple data extraction reports by SAPu2019s SQL
Hi,
Can you please let me know how can I develop simple data extraction report using SAP's sql.
Regards,
KoushikHI,
I have to do a PoC on Data Quality checks. In which there will be few reporting tables. One will be daily agreegate, one weely agreegate etc. Now I have to show those the data in form of reports. and Option is also required to drill down and drill up for those reports.
Please let me know if I am able to clarify my question or not.
Regards,
Koushik -
Simple data inventory using flash cs3
is it possible to create very simple data inventory for
example for a library using flash cs3?
This is not for online purpose... the application contain a
form where users can enter data about the books like date returned
and so on..you're welcome :)
1) that is correct. unfortunately, we can't 'write' to an xml
file from Flash, one needs to parse the data sent from Flash using
a server-side script such as php to perform the actual writing of
the file and store it to a directory location. so in this sense, it
may be 'easier' to use a local database and server (running on the
same machine) and use a intermediary 'helper' interface such as
amfphp.
2) Flash does contain several classes to work with xml data
internally, and is quite powerful in that regard. however, if you
opt to use a system like a DB and amfphp, it can use 'regular'
Flash objects to send and receive data and handles the conversion
automatically, so would ultimately be both simpler to implement and
very very fast. some basics on amfphp can be found here:
http://www.gotoandlearn.com/play?id=78
(don't worry about your English, it's just fine :)
Maybe you are looking for
-
In this episode of the Adobe Creative Suite Podcast, Terry White shows photographers how they can take advantage of their Adobe Creative Cloud Memberships and the hosting included to publish Web Galleries directly from Lightroom 4. http://adobe.ly/WE
-
My touch completely ran out of battery, so i plugged it into my computer. When i did so, the computer told me that there was a malfunctioning device that was detected, so i looked for the solutions it gave me. All it told me to do was to reconnect th
-
Applet can't read local file on web server, security issue!
There is any way to read/write files of web server through the applet except the Signed Applet. If any idea the reply me soon. Thanks in advance
-
Hi Gurus, How to view work centre object A wither in organization & staffing or simple maintenance I assigned workcentre to the position through PP01 but couldn't view in either above. Sunny
-
How to use ST22 to analyse dump analysis in a ABAP program ?