Date settings

Hello

Please see my query below,

I have a little trouble with my date settings.

If $P {from_date} = January 1, 2010
and $P {to_date} = January 2, 2010

Is there a reason why I get all the data for January 2, 2010?

It's probably something simple I'm missing.
select

count(tag_id),
itl.sku_id,
itl.client_id, 
itl.reference_id,
sum(itl.update_qty),
to_char(trunc(itl.dstamp), 'DD-Mon-YYYY') rec_date,
to_char(sysdate, 'DD-Mon-YYYY | HH24:MI:SS') as systemdate,
to_char(trunc(itl.expiry_dstamp), 'DD-Mon-YYYY') exp_date,
s.ship_shelf_life as sku_shelf_life,
s.ship_shelf_life + 2 as plus_shelf_life,
(trunc(itl.expiry_dstamp) - (s.ship_shelf_life + 2)) - trunc(sysdate) as plus_days_left,
(trunc(itl.expiry_dstamp) - (s.ship_shelf_life + 2)) - trunc(itl.dstamp) as plus_days_left_when_rec,
(trunc(itl.expiry_dstamp) - trunc(itl.dstamp)) as clear_days

from inventory_transaction itl, sku s
where s.sku_id = itl.sku_id
and ($P{from_date} is null or ($P{from_date} is not null and itl.dstamp >= to_date($P{from_date}, 'DD-Mon-YYYY')))
and ($P{to_date} is null or ($P{to_date} is not null and itl.dstamp <= to_date($P{to_date}, 'DD-Mon-YYYY')))
and itl.code = 'Receipt'
group by itl.sku_id, itl.client_id, to_char(trunc(itl.expiry_dstamp), 'DD-Mon-YYYY'), to_char(trunc(itl.dstamp), 'DD-Mon-YYYY'),
itl.reference_id, s.ship_shelf_life, s.ship_shelf_life + 2, (trunc(itl.expiry_dstamp) - (s.ship_shelf_life + 2)) - trunc(sysdate),
(trunc(itl.expiry_dstamp) - (s.ship_shelf_life + 2)) - trunc(itl.dstamp), (trunc(itl.expiry_dstamp) - trunc(itl.dstamp))
order by itl.client_id, itl.sku_id
Thanks in advance,

SM.

Sam Mardell wrote:
Is there a reason why I get all the data for January 2, 2010?

Yes :) All dates has a component of hours, minutes, and seconds. When you apply the TO_DATE() function on a string that contains all the month, day, and year component "hour" is by default at midnight (00:00:00). There are several methods to work around this problem:

< to_date($P{to_date}, 'DD-Mon-YYYY') + 1
<= to_date($P{to_date} || '23:59:59', 'DD-Mon-YYYY HH24:MI:SS')
<= to_date($P{to_date}, 'DD-Mon-YYYY') + (60*60*24 - 1)

Above are just examples, there are many more ways to do this.

HTH!

Tags: Database

Similar Questions

  • Have an I phone4 need of mobile data settings as in. Code APN, username and password can someone help please. Mrcgee14.

    Mobile data settings need code AFN telmore, username and password

    Contact your operator.

  • How can I recover my old data settings document files firefox bookmarks and favorites of ie8.

    I need to reinstall windows xp sp2 I turned off my pc by updating the os now I ask a question after the reinstallation of the sp2 would be it possible to recover my old data settings firefox favorites bookmarks of ie8 and norton antivirus 360 documents.

    You might see if this folder is located on your computer.  Depending on how you installed Windows, it could be an old version of some files in pre-installation.

    C:\Windows.Old\

    But beyond that, there's no other place I could think that perhaps it would be after a reinstallation.

    Shameless plug for the new version:
    If you used Windows 8, all of your documents, files, Favorites, bookmarks are saved on your Microsoft Account so that you can use them even if you get a new computer (or reinstall an old one).

  • Z440 - M60 BIOS - time and Date settings

    We can configure the Date and time in the BIOS on a Z440 with worm M60?
    If Yes, where is the option?  Sorry if this is a stupid question.

    I guess I don't think it is preconfigured, but I don't know even how to check the current configuration.

    EskoBomb, BIOS Z840/Z640/Z440 has many changes from previous HP workstations.  The user interface of BIOS F10 is different.  I deleted my previous answer, since it applied to the previous HP workstations.  (Sorry, I misread your original message).

    BIOS Z840/Z640/Z440 has NO settings to change the time and Date.  This generation of workstations doesn't have this option.  The time and date can be set after bootinging, and then edit them in the operating system.

    These BIOS settings are no longer needed.

  • Compaq CQ5210F desktop: when I turn off my desk, I lose my date settings and clock

    When I turn off my computer's power supply, I have now lost all my memory date and time. I just change my cmos battery. Still nothing. Windows 7 64-bit. The new battery would be bad?

    Hi there @Danpurtell

    Welcome to the Forums of HP Support! It's a good place to find the help you need, so many other users, the HP experts and other members of the support staff.

    I understand that your computer is lost the date and time every time that you shut down the computer, and you have replaced the CMOS battery. I'm happy to help you with this.

    It is possible that the battery is bad. Install yourself?

  • Is it possible to migrate data/settings into a new account administrator account

    So I've recently upgraded to Windows 7 to 10 and after that heart stopping moments found all my missing files. Apparently, I had always used the built in Administrator account in windows 7 (stupid I know) and now in windows 10 it really won't do that to me.

    So after finding a way to reactivate and sign in using the built-in and then Administrator tweaking things to make it work mainly with the edge, I was looking for a way to migrate all my settings application, documents, etc. to a new regular profile with administrator privileges.

    Since then, I realized I was still getting some problems in windows 10, so I returned to backup cloned 7 before the update.

    I tried:

    Manually copying files/folders of the users/administrator to a user account with little chance

    Using Windows Easy Transfer, but it wont let me copy the folder Administrator

    And slamming my head on the keyboard.

    I know Mobile files and documents on the habit is hard, but is it possible to get my program etc settings into a new account.

    Thank you

    Ian

    Hi Ian,

    Thanks for posting your query on the Microsoft Community.

    According to your request, I want to inform you that; the setting of the program / account settings cannot be migrated to a new user account, but you can copy the files/folders for a user to another account.

    To copy the files form one user to another, account follow the steps below:

    (1) connect to your computer using administrator user account?

    2) go to C:\Users\User, the user account that you want to copy the files.

    (3) copy the form of files, the user account.

    4) go to C:\Users\User, the user where you want to transfer the files.

    (5) paste the files there.

    It can be useful, we meet with the status of your question. We will be happy to help you.

  • Problem with date settings

    Hi all. I have the problem with the Sub statement


    SELECT THE DOUBLE TO_DATE(:P_DATE,'DD/MM/YY')

    it get me ' 10 / 04/2012 '

    but I want 10/04/12 not as above.

    I saw that DD/MM/YY not like 'DD/MM/YYYY' still it gives me 10/04/2012 why can someone explain?

    Kind regards
    Uraja

    To_Date will always give you the output date format-based nls...

    Instead, you can try

    SELECT to_char (TO_DATE(:P_DATE,'DD/MM/YY'), ' DD/MM/YY') FROM DUAL;

    or replace nls_Date_format jj/mm/aa

  • For the previous fiscal quarter date settings?

    Hello people,
    I have this requirement to choose the dates for the previous quarter. a fiscal quarter is usually January 2011 - March 2011. But in my case, the exercise should be December 2010 to February 2011 and if I check in June 2011 it must return to Mar 2011 until May 2011 and so on. So, how can I optimize to be able to select these dates i.e. 01/12/2010 until 28/02/2011 in where clause for the current date?
    create table test_A (id int, col varchar(50),change_date date);
    
    insert into test_A values(1, 'A',to_date('20101201 000000', 'YYYYMMDD HH24MISS'));
    insert into test_A values(2, 'A1',to_date('20110122 000000', 'YYYYMMDD HH24MISS'));
    insert into test_A values(3, 'A1',to_date('20110202 000000', 'YYYYMMDD HH24MISS'));
    insert into test_A values(5, 'A1',to_date('20110306 000000', 'YYYYMMDD HH24MISS'));
    insert into test_A values(6, 'A1',to_date('20110305 000000', 'YYYYMMDD HH24MISS'));
    insert into test_A values(7, 'A1',to_date('20110307 000000', 'YYYYMMDD HH24MISS'));
    
    
    
    select * from test_A
    1     1     A     12/1/2010
    2     2     A1     1/22/2011
    3     3     A1     2/2/2011
    4     5     A1     3/6/2011
    5     6     A1     3/5/2011
    6     7     A1     3/7/2011
    
    
    I only want to see the following
    
    1     1     A     12/1/2010
    2     2     A1     1/22/2011
    3     3     A1     2/2/2011
    select  *
      from  test_A
      where change_date >= add_months(trunc(sysdate,'Q'),-1)
        and change_date <  add_months(trunc(sysdate,'Q'),2)
    /
    
            ID COL                                                CHANGE_DATE
    ---------- -------------------------------------------------- ---------------
             1 A                                                  20101201 000000
             2 A1                                                 20110122 000000
             3 A1                                                 20110202 000000
    
    3 rows selected.
    
    SQL> 
    

    SY.

  • Why oracle 'to_date' accepts the Date settings

    I tested the 'to_date' function you see below, and I see that Oracle allows me to give this parameter of function with the text data type, and also allows the data type of the date setting.
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 
     
    SQL> 
    SQL> select to_date(sysdate) as s from dual;--21.10.2010
     
    S
    -----------
    21.10.2010
    SQL> select to_date(sysdate, 'DD.MM.YYYY') as s from dual;--21.10.2010
     
    S
    -----------
    21.10.2010
    SQL> select to_date('21.10.2010', 'DD.MM.YYYY') as s from dual;--21.10.2010
     
    S
    -----------
    21.10.2010
    SQL> select to_date(to_date('21.10.2010', 'DD.MM.YYYY')) as s from dual;--21.10.2010
     
    S
    -----------
    21.10.2010
    SQL> 
    I entered the expression of "http://www.lycos.com/" search engine 'oracle to_date function' and it gave me a link to the documentation for this function:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions183.htm
    and the documentation says:
    >
    Goal

    To_date converts a value of DATE data type CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type char.
    >

    My question is: why the function accepts data types Date? has what place behind curtains when the Date has passed? Or what explanation there is, the documentation seems to lie?

    Also, have you also noticed that the forum was often down near last days?

    My question is: why the function accepts data types Date?

    Strictly speaking, this isn't.

    An implicit conversion occurs when provide you a date argument. It gets converted to a string in the format defined in your parameter of the session's nls_date_format.

  • Date settings If/else

    LAMP system

    I have a page with a table that highlights the dates which are older than 6 months. Currently, the only way I found out how to do it is by using a form field 'datethreshold' for a date entry (setting) and by using the following:

    <? PHP if (strtotime ($row_recordset ['LASTCHECK']) < strtotime($_POST['datethreshold'])) {? >}
    < color = "#FF0000" > < STRONG >
    <? PHP echo date (, d/m/Y ', strtotime ($row_recordset ['LASTCHECK']));? >
    < facilities > < / make >

    <? PHP} else {? >}
    blah blah blah...


    I want to be able to do is make this automatic dosing with one less 'now' syntax for 180 days.

    i.e.

    <? PHP $now = date("Y-m-d");? >

    <? PHP if (strtotime ($row_lookup ['LASTCHECK']) < strtotime ($now - 180)) {? >}

    Because dates don't think in terms of numbers, this does not work - any ideas would be greatly appreciated.

    RichardODreamweaver wrote:
    > I want to be able to do it is this automatic dosing with a "now" to make less
    > syntax 180 days.

    Assuming that $row_recordset ['LASTCHECK'] is a date field MySQL, this
    will do:

    If (strtotime ($row_recordset ['LASTCHECK'])< strtotime('-6="" months'))="">
    There more than six months
    }

    --
    Adobe Community Expert David Powers
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • How can I transfer all the data, settings, programs and licenses from 80 GB to 160 GB

    My 80 GB has gone wrong, and I need to transfer everything to a new HD and put it back in the same computer.

    Hello

    I suggest you follow the steps form this link and check if it helps:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-performance/easy-way-to-transfer-OS-from-one-hard-drive-to-a/690869bf-7D48-4484-B963-854fff35674b

    It will be useful.

  • CUCM phone with CTS SW 1.7 Config / MIDlets: location of external data settings

    Q: am I on the right to leave the empty authentication server URL or is it still necessary in the Config of the phone with SW 1.7 / MIDlets running?

    (Background: access to the URL of screenshot of the phone is handled differently with 1.6 and 1.7 CTS endpoints (see here) )

    Cisco Unified Communications Manager Configuration Guide for Cisco telepresence system is not clear about phone configuration / authentication URL:

    On the one hand:

    -with SW 1.7 MIDlets are mandatory

    and

    - table 2-6 says ' leave blank to use the default all fields.» (this of course also means the field"Server authentication" ")

    On the other hand:

    -Chapter 'setting up a remote phone' said

    «.. . Enter the following in the field of the authentication server: http://<> Address >: 8080/authenticate.html IP CTS. »

    NOT differentiating between 1.7 so or SW earlier, do not differentiate the Solutions MIDlet MIDlet / No.

    and

    -Chapter Phone IP MIDlets Interface configuration step 9 just allows me to remove the Service URL and URL at idle, not talking about authentication URL

    Just to say things straight:

    1.7 midlet works both feel so auth. Server is configured on the phone (pointing to the RTC) or if it is empty and the Enterprise effect parameter

    But access to the URL address phone screenshot is possible if I leave the field blank and associate the phone to an existing user of CUCM

    Thanks for any answers

    Thanks for the comments, we will work on the clarification of our documents.

    As you know that prompts you the codec for authorization and, now, because of the security change codec will refuse the request from version 1.7.

    A few things we do now 1.7

    -Remove the URL for authenticating all IP phones
    -Create a new user account inquiry CUCM (example: admin/cisco), with ONLY
    the necessary rights to make screenshots and associated phone.
    -Configure the URL for authentication within the parameters of CUCM company with one IP address instead of the host name
    -Open Ports in the ACL to allow phone to communicate with CUCM

  • Date settings Toad/Oracle SQL Developer

    Dear all, the code below works as a TOAD, but in the Oracle Sql Developer does not work it says the start_date is not declared. Ambersand doent work in Toad? Do not know why. Y at - it a reason for this.
    I used Toad for awhile, now, they are deploying Oracle Sql Developer because it is a free tool.

    SET SERVEROUTPUT ON
    SET VERIFY OFF

    (8) tank variable start_date;


    BEGIN
    : Start_date: = TO_CHAR (TO_DATE ('& 1', 'YYYYMMDD'), 'YYYYMMDD');
    END;
    /

    BEGIN
    DBMS_OUTPUT. PUT_LINE(:START_DATE);
    END;

    Published by: user531731 on 07/23/2009 17:18

    Published by: user531731 on 07/23/2009 17:19

    My recommendation would be to write correctly regardless of the tool.

    SQL> DECLARE
      2    START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('&1','YYYYMMDD'),'YYYYMMDD');
      3  BEGIN
      4    DBMS_OUTPUT.PUT_LINE(START_DATE);
      5  END;
      6  /
    Enter value for 1: 20091010
    old   2:   START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('&1','YYYYMMDD'),'YYYYMMDD');
    new   2:   START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('20091010','YYYYMMDD'),'YYYYMMDD');
    20091010
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • How can I get date uniform and exit time to get-stat on servers located in areas with different regional settings?

    Hello together,

    I use a HSP on different vCenters script all over the world to sample performance data. Unfortunetaly vCenter servers concerninbg time Windows locale and date are different. For this reason that I ve had different and output date at the time of the csv. Here is an example to read a virtual computer processor performance.

    Get-Stat - feature $vm.name - Stat "cpu.usage.average" - IntervalMins 5 - (Get-Date).adddays(-1)-.addminutes(-5)-MaxSamples Start to finish (Get-Date) 288. Select-Object timestamp, value, unit | Export-Csv

    vCenter Server located in the United States with the American Time (12-hour AM/PM) and the settings of Date (day/month/year):

    'Timestamp', 'Value', 'unit '.

    "2010-06-27 12:00 PM","2.75","%.

    "

    "

    vCenter Server located in Europe with countries European regionalen (24 hours) and Date settings (day.month.year):

    Timestamp, value, unit

    "21.06.2010 20:00:00", "3.06", %

    "

    "

    For the import of these data to our central database, the formats must be uniform.

    Someone at - it an idea to get the uniform format?

    Thanks in advance

    Concerning

    Oliver

    Why don't you use the solution in Use-Culture - Culture culture - Script {scriptblock} ?

    You do all the writing to your database in 1 selected (for example en-US culture).

    This way all your date and and digital formats have the same layout.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • 6s still with disabled data roaming

    Recently, I was in Vancouver, and even if I had roaming turned off voice and data on my iphone 6, I was still receiving service. Then I am responsible for roaming by Verizon. I called Verizon, they said, that can't happen. But that was certainly the case. the iOS is 9.1. Is there a problem with the iphone 6 and 9.1 I should know about?

    Hi ginadet,

    I understand that you have some doubts about homelessness, you received while this feature has been disabled. I know it's important to have control over your service, so I'm happy to provide advice for this.

    The first thing I recommend is to make sure that the iOS on your iPhone is updated to ensure the best compatibility. You can see how to do this here:

    Update the software on your iPhone, iPad or iPod touch - Apple Support iOS

    You can also learn more about homelessness here:

    Use the cellular networks on your iPhone / iPad, while traveling abroad - Apple Support

    On the cellular data settings and usage on your iPhone / iPad - Apple Support

    That should clarify things, Bravo!

Maybe you are looking for

  • How can I change the ORDER of my 5 email accounts to my default at the top

    How can I change the order of my 5 email accounts to my default at the top? Currently using any option to e-mail browser (Chrome Firfox IE) sends using one upstairs that is one that I never use. I specifically put by default in the settings option an

  • Toshiba Bluetooth stack miniPCIe Perripheriques

    I would like to install a Bluetooth (or combo) miniPCIe card in a laptop with a bluetooth chipset supported by the toshiba bluetooth stack software.And on the net, it is impossible to find a list of the supported devices. Anyone can help with this, t

  • HP Envy 4500 printer all in one

    My Hp Envy 4500 printer all-in-one lights up not down IT. If I unplug the power cord, then plug it back it then the printer lights for about 14 seconds and then turns off.  Any ideas?

  • Color Laser Jet MFP M880 flow: Staple Option grayed out

    Hello world So basically one of our users has not had the function of staples when it tried to print a document. It is located in the tab out in properties during printing. But it was grey for him. I checked the drivers and everything was set up very

  • BBM EXTREEMLY URGENT - please help ASAP

    Hi, please help. This isn't a matter of life or death... but close enough. I have a Samsung Galaxy S4 and tried to e-mail 1 large cats bbm history for me and my bbm crashed. Now, I don't see no bbm conversations. I don't see my contacts, but not cats