Convention for date diffs?

I run into this problem again and again with date functions
that use Now(). In this case, I just want to compare today's actual
date with another date, and determine the numbers of days
difference, not counting the time of day. But if I use
datediff(Now(), 'May 25, 2006'), it returns 0, because there isn't
a full day's difference between May 24, 2006 12:30 PM and May 25,
2006 12:00 AM (May 25 being tomorrow). What I want to see is "1".
I've always used Now()-1 to compensate for this, but that
doesn't seem very elegant. Is there a simply way to code "return
the difference between today's date and another date, without the
time of day being factored in?"

JMGibson3 wrote:
> How bout simply dropping time out of the equation
altogether(my session var was already date only):
>
> <cfif
DateDiff("d",DateFormat(Now(),"MM/DD/YYYY"),Session.SelThruDate) GT
7>
or you could use cf epoch offset (days since 31-dec-1899):
<cfif int(Session.SelThruDate) - int(now()) GT 7>

Similar Messages

  • Naming conventions for data types

    In my functional specs I have been given field names
    Client Number
    Record Type
    Customer Name and so on
    I need to create custom data types for all these and assign them to std values (vbak-kunnr, adrc-name1)
    I am trying to determine what is the best naming convention to use for my custom data types
    Would the convention be to use, new_kunnr, new_adrc_name1 or perhaps just ClientNumber, RecordType, CustomerName and so on

    I think its best I include my scenario so people can better answer my question
    My report has four different parts, each has a filler, record type, customer number which need to be initialized to certain values that are different
    The four parts are Name/Address, Credit Order, Sub total and Total
    Name/Address has Record type = A , customer number = vbak-kunnr
    Credit Order has Record type = R, customer number = vbak-kunnr
    SubTotal has Record type= space and customer number = 99
    Total has Record type = S and customer number = 9999
    So I have to create variables for these and am trying to figure out a proper naming convention
    I could do RecordType_Name, RecordType_CreditOrder and so on but that does not seem the best way to me. Any ideas!

  • Fun.module for date diff

    Hello,
    Is there any function module available for giving the difference between two dates.
    For ex:
    date1 = 01/30/2000; date2: 02/30/2002
    If I query for difference it should in below format :Years & Months.
    i.e the difference between date2 & date1 should be shown as 2 years 1 month.
    Thanks,
    Kanaka

    hi,
      There is no need of any function module for knowing the differnece in dates.
      v_diff_days = date1 - date2.
      You get the difference in no of days.
      Later you can divide it by 365 and know the difference in years.
      v_yrs = v_diff_days/365.
    Regards,
    Sailaja.

  • Someone has nomenclature (naming conventions) for oracle data integrator?

    Someone has nomenclature (naming conventions) for oracle data integrator?

    You should really move this question over to the Oracle Data Integrator forum(Data Integrator for a more expedient response.

  • Using translate for date in the control file !!

    Hi,
    I am having data file where in i expect date but get non-numeric character.
    I am generating control file dynamically (programatically).
    While creating control file i know that here the type of data will be date so i put datatype as date. But at one place i got non numeric character instead of date.
    Now i want to put somekind of logic built in my dynamic generation which will check whether if value within that column is character then make it null and then load data. And if it is numeric keep it as it it.
    i.e.
    if(non-numericChars)
    make value null before loading.
    else
    keep the value as it and then load it.
    I heard that with translate function we can do that. Right ?
    So if i have a line like this in my control file:
    column_Name date "MM/DD/YYYY HH:MI:SS AM"
    How should i write the above statement to put the above mentioned logic.
    Any help would be highly appreciated.
    Regards,
    Dipesh

    and Perhaps TO_DATE can help you :
    TO_DATE
    Syntax
    to_date::=
    Text description of to_date
    Purpose
    TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype. The fmt is a date format specifying the format of char. If you omit fmt, then char must be in the default date format. If fmt is 'J', for Julian, then char must be an integer.
    Note:
    This function does not convert data to any of the other datetime datatypes. For information on other datetime conversions, please refer to TO_TIMESTAMP, TO_TIMESTAMP_TZ, TO_DSINTERVAL, and "TO_YMINTERVAL".
    The default date format is determined implicitly by the NLS_TERRITORY initialization parameter, or can be set explicitly by the NLS_DATE_FORMAT parameter.
    The 'nlsparam' has the same purpose in this function as in the TO_CHAR function for date conversion.
    Do not use the TO_DATE function with a DATE value for the char argument. The first two digits of the returned DATE value can differ from the original char, depending on fmt or the default date format.
    Note:
    This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion. Please refer to "Datatype Comparison Rules" for more information.
    See Also:
    "Date Format Models"
    Examples
    The following example converts a character string into a date:
    SELECT TO_DATE(
    'January 15, 1989, 11:00 A.M.',
    'Month dd, YYYY, HH:MI A.M.',
    'NLS_DATE_LANGUAGE = American')
    FROM DUAL;
    TO_DATE('
    15-JAN-89
    The value returned reflects the default date format if the NLS_TERRITORY parameter is set to 'AMERICA'. Different NLS_TERRITORY values result in different default date formats:
    ALTER SESSION SET NLS_TERRITORY = 'KOREAN';
    SELECT TO_DATE(
    'January 15, 1989, 11:00 A.M.',
    'Month dd, YYYY, HH:MI A.M.',
    'NLS_DATE_LANGUAGE = American')
    FROM DUAL;
    TO_DATE(
    89/01/15
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions137a.htm#SQLRF06132
    Joel P�rez

  • How to use same CMOD code for 2 Diff. variableS?

    Experts,
    I have written some code under CMOD. Now, i have another query which i could use the same CODE, but diff. variable
    ( In the CMOD code, i am passing one User input variable ). For the 2nd query i have to pass different User Input variable.
    How OR what should i wright to tell CMOD, that IF its Query # 1 then use ABC variable and if Query # 2 then use XYZ .
    thanx

    Dear Hon Bon,
    Let us have a small example on ur scenario.
    Lets take the requirement as to calculate Month from Date. (In both the queries).
    Query 1: Input variable for Date is say  'ZDATE1'.
    Query 2: Input variable for Date is say  'ZDATE2'.
    Now let the CMOD variable be ZVAR_CALMONTH.
    when 'ZVAR_CALMONTH'.
        clear: lwa_var_rng,
               lwa_range.
        loop at i_t_var_range into lwa_var_rng where vnam = 'ZDATE1' or vnam = 'ZDATE2'.
          concatenate lwa_var_rng-low+0(4)
                      lwa_var_rng-low+4(2)
                 into lwa_range-low.
          lwa_range-sign = 'I'.
          lwa_range-opt  = 'EQ'.
          append lwa_range to e_t_range.
          clear lwa_range.
        endloop.
    Now when you execute the Query1,  the above code will work for 'ZDATE1' variable,
    if you execute the Query2,  the above code will work for 'ZDATE2' variable.
    So, the key point is,
    1. You need not worry about which query is getting executed. Whatever the query, the particular user entry variable of that query will be taken care.
    2. This method works only if the cmod variable (ZVAR_CALMONTH) is used in both the queries (Ofcourse its ur requirement).
    3. If queries have both the user entry variables then the cmod will work differently(it ll get data from both the user variables).
    You shall try ur code in the above example by replacing the code and the variable names and try playing around it.
    Hope this helps.
    Regards,
    Guru

  • Date Diff Issues

    1. Subscriber – Employee Details has these three records
    2. Call Details  has these two records
    My main goal is to populate date diff in table 1 as 1 if "work order check in date" >= 3 of Aspect calender date from the 2nd table.
    The Problem i am facing is that the date diff in table 1 does not populate. I have come to an understanding that the issue is because of many t many relationship between table 1 and table 2. Is there a way to work around this?
    Date Diff formula - If(DaysBetween([Work Order Check In Date];[Base2]) >=3 ;1;0)

    Hi Akshay
    Did you try removing If condition and able to see the date difference result,if so is it working fine or not? If it is working fine use this result and define another variable for If-else and validate the condition
    Regards
    Bose

  • Define Clearing Accts for Payment Diff. with Altern.Currency

    Dear SAP Gurus,
    Please suggest difference between Define Clearing Accts for Payment Diff. with Altern.Currency & Define Accounts for Payment Differences with Altern. Currency.
    I am not able to understand what the use of defining Accounts for Payment Differences with Altern. Currency in two activities.
    Early reply would be appreciated.
    Regards,
    Prafful kansal

    Hi,
    For this Scenario payment clearing is based on the exchange rate currencies for that purpose we configure that 2 setup accounts.
    Briefly: If Invoice is raised as per date feb 1st  (1 us dollar = 45 rupees)and payment received on that 1 mar ( 1 us dollar=40 Rupees)for this the exchage rate values are may be different for that purpose.
    For this scenarios it will be loss or gain.
    Hope you will understand.
    Regards,
    Kanike

  • Can anyone tell me the naming conventions for PSa tables

    hi all,
    After the data is loaded into the psa. how to look at the records that are there in psa. And can anyone tell me the naming conventions for psa tables.
    like BIC/????
    thanxs in advance
    regds
    hari

    Hi Hari,
    You want to know the naming convention of PSA table. For that there is a simple technique try this.
    Go to - T code SE11
    In the database table check box give  /BI*  and click search
    next window  in the Description Text box give the r data source name(master)  like
    YIO_ID_ATTR which is assigned to infosource. then click OK.
    then you get the psa table structure.
    You can take structure and check in the T code SE 11
    Hope this is fine.
    Regards
    Sreekanth

  • Naming Convention for  path in Application Server

    Hello Guru's,
                        I asked my basis team to create flat file source system. he asked me " what path to follow, any sub directories"?.  
    they are asking me naming convention for a path in App server to create i think ? usually what will be the naming convention for path.
    please help me
    Thanks,
    Prashanth

    Hi,
    Create flatfile source system is no need path and sub directory on app server. You can create yourself go TCODE RSA1>Source system>file-->create.
    path and sub directory only need if you want to load data from flatfile which is stored in application server. This will be determined in extraction tab of your datasource and infopackage.
    Hope this helps.
    BR
    TRUC

  • Naming Conventions for Workflow

    Hello,
    does anybody have a document for Naming Conventions for Workflow.
    I found nothing the last hour.
    Thanks in advance for any help ...
    Stefanie

    Hi,
    I am sending you naming convention which we followed in our project.
    Workflow Template & Standard Task:
    SAP/R3 Limitations:
    Workflow Template & Standard Task names are limited to 12 bytes.
    Standard:
    Bytes 1-3 of the Workflow Template & Standard Task (see following table) are intended to give an overview of general information regarding the Workflow Template & Standard Task.
    Characters 4-12 of the name should be chosen to impart some idea of the Workflow Template & Standard Tasku2019s use and/or contents.  (The portion of the Workflow Template & Standard Task name that forms the unique identifier may, or may not, contain underscores characters to enhance Workflow Template & Standard Task name readability.)
    Position     Description     Sample Values     Sample Meanings
    1     Table system life     Z/Y                Permanent/Temporary
    2     Application Type     *                    See Application Designators (Appendix B)
    3     OPCO/Region     *                    See OpCo Initial Chart (Appendix A) 
    4-12     Unique identifier     text                     Unique identifier; may include underscores
    Example: ZS7_IDEL9 (I:-Inbound, DEL: - OILDEL 9:- Original)
    Business Object:
    SAP/R3 Limitations:
    Business Object names are limited to 10 bytes.
    Standard:
    Bytes 1-3 of the Business Object (see following table) are intended to give an overview of general information regarding the Business Object.
    Characters 4-12 of the name should be chosen to impart some idea of the Business Objectu2019s use and/or contents.  (The portion of the Business Object name that forms the unique identifier may, or may not, contain underscores characters to enhance Business Object name readability.)
    Position     Description     Sample Values     Sample Meanings
    1     Table system life     Z
    Y     Permanent
    Temporary
    2     Application Type     *     See Application Designators (Appendix B)
    3     OPCO/Region     *     See OpCo Initial Chart (Appendix A) 
    4-12     Unique identifier     text     Unique identifier; may include underscores
    Example: ZS7_OILDEL (Business Object for OILDEL Message Type)
    Methods
    Method names should begin with a verb:
    Examples: GET_STATUS, CREATE_ORDER, DETERMINE_PRICE
    For Parameters:
    IMPORTING parameters     IM_<parameter name>
    EXPORTING parameters     EX_<parameter name>
    CHANGING parameters     CH_<parameter name>
    RESULT     RE_<result>
    Events
    Event names should have the form
    <noun>_<participle>:
    Examples: BUTTON_PUSHED, COMPANY_CODE_CHANGED, BUSINESS_PARTNER_PRINTED
    Note: There is no specific naming convention for Container Variables in workflow & for Key Fields & Attributes in Business Object. These variables name should be chosen to impart some idea of the variablesu2019 use and/or contents. 
    Appendix A
    ABAP Programming Standards:  OpCo/Region Initial Chart
    Old #     Company Name                               Proposed #     Accounting Location
    98     Common                                                     A              San Ramon
    95     FSC                                                     B              San Ramon
    80     Chevron Chemical Company                      C              San Ramon
    89     Chevron USA-Downstream & General     D     Walnut Creek
    75     Chevron Real Estate Management      E     San Francisco
    76     Chevron Information Technology Company      F     San Ramon
    77     Gulf Oil Great Britain                                    G     London
    85     Corporation (Acct. by Corp.)                    H     San Francisco
    83     Chevron International Oil company              J     San Ramon
    87     Chevron U. K. Limited                               K     England
    86     Corporation (Acct. - Local Office)                    L     Various
    96     P&M Coal & Mining Company                   M     Denver
    94     Corporation (New York)                   N     New York
    90     Chevron Pipeline Company                    P     San Ramon
    79     Chevron Canada Resources, Ltd.              R      Calgary
    92     Chevron Shipping Company                  S                     San Francisco
    81     Chevron Petroleum & Tech Co.                  T                     Houston
    91     Chevron USA Upstream                  U                     Concord
    78     Chevron Canada, Ltd.                              V                     Vancouver
    93     CUSA Warren Petroleum                  W     Tulsa
    84     Chevron Overseas Petroleum, Inc.            X                     San Ramon
    88     Chevron Research & Tech. Company        Y      Richmond
    -     Corp. GLX Common validations                   Z      San Ramon
    -     PCA                                                   3                     San Ramon
    -     Tax                                                   4                     San Ramon
    -     Audit                                                   5                     San Ramon
    -     Asia-Pacific                                   6                     Global
    -     Africa                                                   7                     Global
    -     Latin America                                   8                     Global
    Appendix B
    ABAP Programming Standards:  Application Designators
    A     Assets Accounting
    C     PPC
    D     DASS (control station)
    E     RIVA/IS-Oil
    F     Financial Accounting (incl. Joint Venture)
    G     General Ledger
    H     Human Resources Planning
    I     Plant Maintenance
    J     Publishing
    K     Cost Accounting
    L     Inventory Management
    M     Materials Management
    N     Hospital
    O     unassigned
    P     Human Resources
    Q     QSS (Quality assurance)
    R     PRA (Prod & Revenue Acctg)
    S     Basis
    T     Projects
    U     Enterprise Data Model
    V     Sales
    W     MMS (Merchandise mgt. System)
    X     unassigned
    Y     Customer head office
    Z     Customer branch
    <inappropriate content removed by moderator>
    Thanks
    Yogesh Sharma
    Edited by: Mike Pokraka on Jul 2, 2008 10:34 AM

  • Date diff

    Hi,
    I went through a lot of date related post and was able to write a script(with alps help-Re: Days behaviour between two dates Now iam using 11.1.2.1 planning on top of essbase. While my end date is saved as a sub var with value 20131231. the beginning date is a user input in data forms in planning. I used the member that hold this date value in the script but it doesnt do the calculation. No value is getting populated as output. the script is working , as ive tested it with two sub vars instead of user input.
    But i came across posts that spoke about difference in format that dates gets saved for essbase and planning. the date that i enter in planning reflects as "2.0130405E7" in essbase when i retrieve .
    Please do help.
    thanks

    Hi Alp,
    Am sorry for replying late. Here s waht my situation. The Year end date wd be saved as subvar in essbase, value =20131231. Project end date would be a date value fed from planning data forms to a account member of type date. Ive took help from one of your post and just inputted my values as you can see below.
    var y1, y2, m1, m2, d1, d2, difx1, difx2,diff,a,b,x;
    SET CREATENONMISSINGBLK ON;
    SET CACHE HIGH;
    Fix(&Curr_Year,"Actual","HSP_InputValue","No Employee","No Product","1st Pass","GL_Load","No Line Item","No Asset","No_Custom1","Jan")
    Fix("50")
    FIX("01-03-390")
    "Depreciation-IT HW"
    y1=@ROUND("Project End Date"/10000,0);
    y2=@ROUND(&YearEnd/10000,0);
    m1=@ROUND(("Project End Date"-y1*10000)/100,0);
    m2=@ROUND((&YearEnd-y2*10000)/100,0);
    d1="Project End Date"-(y1*10000+m1*100);
    d2=&YearEnd-(y2*10000+m2*100);
    difx1=@TODATEEX("mm/dd/yyyy",@JconcatStrings(@LIST(@JgetStringFromDouble(m2),"/",@JgetStringFromDouble(d2),"/",@JgetStringFromDouble(y2))));
    difx2=@TODATEEX("mm/dd/yyyy",@JconcatStrings(@LIST(@JgetStringFromDouble(m1),"/",@JgetStringFromDouble(d1),"/",@JgetStringFromDouble(y1))));
    diff=@datediff(difx2,difx1,DP_DAY);
    "Depreciation-IT HW"=@ROUND(diff*("165012"/1095),0);
    "Total Budget required"
    "Total Budget required"="Fit Out Cost"+"165012"+"165007"+"165017";
    endfix;
    endfix;
    endfix;
    The rule started working fine, for dates i inputed through the data form, taking value of Project End date. But since it was just under testing i had Fixed it for Jan alone. Then when i included other months it started to fail saying Error in date formatting. And then a few times i went back and saw the rule run for Jan but later it stopped for all.
    the value of project end date gets saved in essbase as 2.0130131E7. But in planning when i check for raw data it shows 20130131, so i thought the rule was logically fine.
    please do direct me in the right way.
    thanks,

  • Whats most common naming convention for MP3s (what does iTunes store use?)

    Trying to organise all my tags and music.
    I am using iTunes and some other tag (tag%rename) WMP etc, as some seem to not show all the tgs of other programs)
    However what is the generalised, most common naming convention for MP3 files?
    ie. track no, Album, artist etc.
    Also Ive never bought music from iTunes store yet, only got podcasts and stuff, but when you do , what is the filename convention they use please?
    cheers
    Mac OS X (10.5) iMac 20" 2Ghz (1st ever Mac Comp)

    iTunes has no automatic tag look up function for anything other than CDs (through GraceNote). I import a lot of mp3s (legally obtained) that need tweaking. Also, GraceNote doesn't provide lyrics. If I just need to edit a couple of tracks, the iTunes interface is fine. But for bulk adding of artwork or searching for release dates or lyrics, I use MpFreaker. I find it works best if you do small batches and keep an eye on what it comes up with. Sometimes, well, rarely, it's way off base.
    There may be better utilities out there but MpFreaker was recommended to me by someone I trust who spends a lot of time reviewing such things and it works for me so I haven't looked for anything else. You might find more reviews of other software at www.ilounge.com
    Best of luck.

  • Oracle Recomanded Naming Conventions for SOA

    Hi,
    We are working on a 12i implementation project using SOA (BPEL) for interface development and Oracle Data Integrator for conversion. Could you please let us know about oracle recomanded naming conventions for
    1. Adapter Service
    2. Adapter Connection Factories
    3. Routing Services
    4. XSD Files
    5. XSL Transformation Files
    6. ...etc
    Is there any oracle corporation provided naming conventions document on these? If so please let us know. Your quick help would be highly appreciated.
    Regards

    If the names are meaningful (which will depend on what objects are in the different schemas) and the underlying architecture is reasonable, then the naming convention would be a good practice.
    - How do the objects in the ABC schema relate to the objects in the ABC_ADMIN schema?
    - What, exactly, does the _ADMIN suffix indicate?
    My unfounded guess is that you have two related schemas because you're creating one schema that owns the objects and another schema that has restricted access to those objects (ideally just via procedures, functions, and views) for applications to use to log in. If that's the case, it's not obvious to me which of ABC and ABC_ADMIN would own the objects for the ABC application. But if you're actually separating the objects for other reasons, then _ADMIN may make perfect sense.
    Justin

  • RAID 0 for Data on a Bootcamp setup?

    I have a MacPro 5,1 running 10.8.5 along with Windows 7 through Bootcamp.  Each of the operating systems is on its own separate SSD.  I also have a conventional hard drive installed for data; the data drive has a GUID partition for OS X data and an NTFS partition for Windows data.  I have another available hard drive and I was wondering if I could install this second drive, set up the two conventional drives as a RAID 0 (for speed) with a GUID partition and an NTFS partition.  Since the drives will be installed in the MacPro drive bays, this would be a software RAID.  Can this be done with both operating systems?  Can I set it up using one of the OS's and have it recognized by the other, or would I have to set up the RAID twice, once in OS X and again in Windows?  Has anybody tried this or will I be the first?
    TIA,
    Dennis

    I would say the Windows PC would be your best bet but the odds of recovering anything at all is still extreme poor even there.
    The way RAID 0 works is a bit like dealing cards. When you start a new hand in a card game the dealer deal a card to each player in turn. In the case of RAID 0 the computer is the dealer and the disks are the players.
    So what you are attempting to do is undeal the hand. Now while that may sound trival, it is in fact not. Hence on of the reason that everyone says RAID Arrays should always be backed up.
    Allan

Maybe you are looking for