Date calculation returns a decimal. Is this right?

Hi Folks,
Forgive me, for I am a newbie.
I'm trying to do a simple date calculation
select SYSDATE - TO_DATE('10/DEC/1986', 'DD/MON/YYYY') from dual
and the result is
"8147.62126"
Isn't the result meant to be a date? Since I am substracting a date from a date?
Thanks :)

You are not getting date. Its a number.
What you are doing is
geting the no of days between today and 10-dec-1986 in days/hours/min/seconds
sysdate has hours/mins/seconds
if you do
select trunc(SYSDATE) - TO_DATE('10/DEC/1986', 'DD/MON/YYYY') from dual
then you will get the difference in days.
Alvinder

Similar Messages

  • HT201299 I have no cellular data option on my ipad2 ,is this right

    Could someone tell me why i can't find the cellular dat option on my ipad2

    After further research I have learned that this iPad2 is only wifi....what a rip off!  It was a gift for Christmas to upgrade from iPad.....which has cellular.  I'll go back to the old.  Thanks!

  • Dynamic Calc processor cannot lock more than [100] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).

    Hi,
    Our Environment is Essbase 11.1.2.2 and working on Essbase EAS and Shared Services components.One of our user tried to run the Cal Script of one Application and faced this error.
    Dynamic Calc processor cannot lock more than [100] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).
    I have done some Google and found that we need to add something in Essbase.cfg file like below.
    1012704 Dynamic Calc processor cannot lock more than number ESM blocks during the calculation, please increase CalcLockBlock setting and then retry (a small data cache setting could also cause this problem, please check the data cache size setting).
    Possible Problems
    Analytic Services could not lock enough blocks to perform the calculation.
    Possible Solutions
    Increase the number of blocks that Analytic Services can allocate for a calculation:
    Set the maximum number of blocks that Analytic Services can allocate to at least 500. 
    If you do not have an $ARBORPATH/bin/essbase.cfg file on the server computer, create one using a text editor.
    In the essbase.cfg file on the server computer, set CALCLOCKBLOCKHIGH to 500.
    Stop and restart Analytic Server.
    Add the SET LOCKBLOCK HIGH command to the beginning of the calculation script.
    Set the data cache large enough to hold all the blocks specified in the CALCLOCKBLOCKHIGH setting. 
    Determine the block size.
    Set the data catche size.
    Actually in our Server Config file(essbase.cfg) we dont have below data  added.
    CalcLockBlockHigh 2000
    CalcLockBlockDefault 200
    CalcLockBlocklow 50
    So my doubt is if we edit the Essbase.cfg file and add the above settings and restart the services will it work?  and if so why should we change the Server config file if the problem is with one application Cal Script. Please guide me how to proceed.
    Regards,
    Naveen

    Your calculation needs to hold more blocks in memory than your current set up allows.
    From the docs (quoting so I don't have to write it, not to be a smarta***:
    CALCLOCKBLOCK specifies the number of blocks that can be fixed at each level of the SET LOCKBLOCK HIGH | DEFAULT | LOW calculation script command.
    When a block is calculated, Essbase fixes (gets addressability to) the block along with the blocks containing its children. Essbase calculates the block and then releases it along with the blocks containing its children. By default, Essbase allows up to 100 blocks to be fixed concurrently when calculating a block. This is sufficient for most database calculations. However, you may want to set a number higher than 100 if you are consolidating very large numbers of children in a formula calculation. This ensures that Essbase can fix all the required blocks when calculating a data block and that performance will not be impaired.
    Example
    If the essbase.cfg file contains the following settings:
    CALCLOCKBLOCKHIGH 500  CALCLOCKBLOCKDEFAULT 200  CALCLOCKBLOCKLOW 50 
    then you can use the following SET LOCKBLOCK setting commands in a calculation script:
    SET LOCKBLOCK HIGH; 
    means that Essbase can fix up to 500 data blocks when calculating one block.
    Support doc is saying to change your config file so those settings can be made available for any calc script to use.
    On a side note, if this was working previously and now isn't then it is worth investigating if this is simply due to standard growth or a recent change that has made an unexpected significant impact.

  • This right...i tried all kind of data commands

    USING:ORACLE 9i
    For each of the following tasks, determine (a) the SQL statement needed to perform the stated task using the traditional approach and (b) the SQL statement needed to perform the stated task the JOIN keyword.
    1. A list that displays the title of each book & the name and phone number of the person at the publisher's office whom you would need to contact to record each book.
    SELECT title, name, customer
    FROM books JOIN publisher
    WHERE books.pubid = publisher.pubid
    AND
    c.books = record
    2. Determine which orders have not yet shipped & the name of the customer that placed each order. Sort results by dates on the orders was placed.
    SELECT lastname, firstname, order#
    FROM customers c, orders, o
    WHERE c.customer# = o.customer#(+)
    ORDER BY c.customer#;
    3. List the customer number & names of all individuals have purchased books in the Fitness Category.
    SELECT title, firstname, lastname
    FROM customers, orders, orderitems, books
    WHERE customers.customer#=orders.customer#
    AND orders.order#=orderitems.order#
    AND orderitems.isbn=books.isbn
    ORDER BY title = (‘Fitness’)
    4. Determine book Jake Lucas has purchased.
    SELECT lastname, firstname, order#
    FROM customers c OUTER JOIN orders o
    ON c.customer# = o.customers#
    ORDER BY c.customers# = (‘Jake Lucas’)
    5. Determine profit of each book sold to Jake Lucas. Sort results by date of order. If more than 1 book was ordered, have results sorted by profit amount in descending order.
    SELECT lastname, firstname, order#
    FROM customers, orders, orderitems, books
    WHERE "Profit"
    ORDER BY "Profit" desc;
    6. Which book was written by an author with the last name Adams?
    SELECT title, authorid
    FROM books, bookauthor
    WHERE author ('ADAMS')
    7. What gift will a customer who orders the book Shortest Poems receive?
    SELECT title, customer, gift
    FROM books, promotion ('Shortest Poem')
    ON retail BETWEEN minretail AND maxretail
    8. Identify the author(s) of books ordered by Becca Nelson
    SELECT lastname, firstname, title, authorid
    FROM books, bookauthor
    WHERE authors
    ORDER BY ('Becca Nelson')
    9. Display list of all books in BOOKS table. If a book has been ordered by a customer, also list the corresponding order number(s) & state which the customer resides.
    SELECT lastname, firstname, state, books, order#
    FROM state s, customers c, orders o
    WHERE c. customer# AND s. customer# = o. customer#
    10. Produce a list of all customers live in the state of Florida & ordered books about computers.
    SELECT lastname, firstname, state, books, order#
    FROM state s, customers c, orders o ('Florida')
    WHERE c. customer# AND s. customer# = o. customer#
    ORDER BY ('Computers')

    HOW ABOUT NOW. IS THIS RIGHT NOW
    USING:ORACLE 9i
    For each of the following tasks, determine (a) the SQL statement needed to perform the stated task using the traditional approach and (b) the SQL statement needed to perform the stated task the JOIN keyword.
    1. A list that displays the title of each book & the name and phone number of the person at the publisher's office whom you would need to contact to record each book.
    SELECT title, name, customer
    FROM books NATURAL JOIN publisher
    WHERE books.pubid = publisher.pubid
    AND c.books = record
    2. Determine which orders have not yet shipped & the name of the customer that placed each order. Sort results by dates on the orders was placed.
    SELECT lastname, firstname, order#
    FROM customers c, JOIN orders, o
    WHERE c.customer# = o.customer#(+)
    ORDER BY c.customer#;
    3. List the customer number & names of all individuals have purchased books in the Fitness Category.
    SELECT title, firstname, lastname
    FROM customers,JOIN orders, orderitems, books
    WHERE customers.customer#=orders.customer#
    AND orders.order#=orderitems.order#
    AND orderitems.isbn=books.isbn
    ORDER BY title = (‘Fitness’)
    4. Determine book Jake Lucas has purchased.
    SELECT lastname, firstname, order#
    FROM customers c OUTER JOIN orders o
    WHERE lastname = 'Lucas' and firstname = 'Jake'
    ON c.customer# = o.customers#
    ORDER BY c.customers# = (‘Jake Lucas’)
    5. Determine profit of each book sold to Jake Lucas. Sort results by date of order. If more than 1 book was ordered, have results sorted by profit amount in descending order.
    SELECT lastname, firstname, order#
    FROM customers, JOIN orders, orderitems, books
    WHERE "Profit"
    COUNT() and GROUP BY
    ORDER BY "Profit" desc;
    6. Which book was written by an author with the last name Adams?
    SELECT title, authorid
    FROM books, JOIN bookauthor
    WHERE author upper(bookauthor.lastname) = 'ADAMS'
    7. What gift will a customer who orders the book Shortest Poems receive?
    SELECT title, customer, gift
    FROM books, JOIN promotion ('Shortest Poem')
    ON retail BETWEEN minretail AND maxretail
    8. Identify the author(s) of books ordered by Becca Nelson
    SELECT lastname, firstname, title, customers authorid
    FROM books,JOIN customers, bookauthor
    WHERE customers
    ORDER BY ('Becca Nelson')
    9. Display list of all books in BOOKS table. If a book has been ordered by a customer, also list the corresponding order number(s) & state which the customer resides.
    SELECT title, o.order#, state
    FROM books b LEFT JOIN orderitems i
    ON b.isbn=i.isbn
    left JOIN orders o
    ON o.order#=i.order#
    left JOIN customers c
    ON o.customer#=c.customer#
    ORDER BY title;
    10. Produce a list of all customers live in the state of Florida & ordered books about computers.
    SELECT lastname, firstname, state, books, order#
    FROM state s,JOIN customers c, orders o ('Florida')
    WHERE c. customer# AND s. customer# = o. customer#
    ON o.customer#=c.customer#
    ORDER BY ('Computers')

  • Scheduled report gets no data but returns success status

    I have a large scheduled webi report which normally takes 2 hours to run against SAP BW. Sometimes, the report will complete very quickly (within 30 miunutes) and returns success, but there is no data in the report. Is this a WEBI problem  or some sort of BW time-out? The thing bothers me is that it should not have returned success.
    I'm using 3.1 SP2, FP 2.5.

    How much huge data you have?? (No.of rows -- In WebI)
    Scheduling done by User logged in BO or Administrator??
    If User, he/she have rights to do that(data access) or have only Schedule right??
    Thank You!!

  • Date Calculation in BEx

    Hello All,
    In my report, User wants to see a day counter which is the dfference of a date (date coming from cube) and Current date. For current date  we are using 0f_aday sap exit. How we can we acheive this, does it involve any User exits at the back end or can I use a calculated keyfigure to find the difference between these two dates.
    Please reply to this as it is very Urgent Issue
    thank you

    HI AL,
    Thanks for the udpate. But I believe we can update any thread if its related with the same subject if its less than 3 years. Is it not right ? I have a mail in my inbox, from some moderator confirming the same. That is the reason I have updated this thread...as its related to the same question and this thread is created n 2011.
    Anyway, thanks for the answer. I will change the dimension to date and calculate the difference from the 2 variables.
    Reg another doubt, from the below link...
    https://docs.google.com/viewer?a=v&q=cache:YQS2jPhWysAJ:www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/705734f2-4e85-2e10-2ebf-891d0110de74%3FQuickLink%3Dindex%26overridelayout%3Dtrue+&hl=en&gl=au&pid=bl&srcid=ADGEESjL8dx81tAAJNL0Ln4c2MW4k3yZRDNFsop1pptOc3bQf1xU0Le9e3loFsZXJi5rWuYt3j7yoStGMktsL5XEdV9T3ONzdKay0x5yrIbaUBB3Dpz1Fr6xuggf_IZX-S0Q4WONpBhN&sig=AHIEtbTZfXXLN4gZCsw7qpZXgrkjeCYLcA
    what is the field used for Interval ( from, to , range) . You have missed my other question, why am I getting X below the result while doing the date calculation . I mean I am getting the result, but below every row, there is a X . Any ideas ?
    Thanks,
    DR

  • NUMBER return types (Decimal/Int16/Int32) how does it work?

    We ran into a problem with a stored procedure returning the result of a select (using Fill method).
    Sometimes some data comes back as int32, sometimes the same data has decimal as datatype.
    We've been struggling to get the same datatype back all the time for the same column. Unfortunately so far without success. The problem is that these columns are part of our key and we can't use a 'relation' between them if the datatypes are int32/decimal: they don't match.
    To simulate the problem:
    Create table myTest (col1 number(2));
    insert a row (e.g. 12)
    SELECT col1 FROM myTest
    this becomes an Int16 when retrieved.
    now comes the strange part:
    SELECT col1 FROM myTest
    UNION
    SELECT 0 FROM DUAL
    returns an DECIMAL.
    We tried:
    SELECT col1 FROM myTest
    UNION
    SELECT TO_NUMBER(0,2) FROM DUAL
    but this does not work, it still returns an Decimal (expected Int16).
    We tried to make the to_number into an outer select, we tried to create an UDT and populate that one, we tried a lot but did not succeed in get a guaranteed Int32 back.
    Any ideas on how to resolve this?

    Out of curiosity
    what does
    "select TO_NUMBER(0,2) from dual" returns? A Decimal or Int16?
    Maybe (i am really guessing here) the union stmt returns a NUMBER(x,y) type which will cause the provider to gives you back a Decimal .net type.
    Arnold

  • MDX Query using BottomCount to limit Median calculation returns null

    I'm building a new cube that includes some person age values that aren't useful when summed, but are
    useful when the median is determined. The measure group that contains the measure for the age has a 1-1 relationship with a dimension in the cube because both use the same table as the source. This is important because I use the key attribute of the dimension
    as the set expression in the Median function to prevent any summation before the median is found. Here is the code for the original median calculation:
    MEMBER Measures.[Median Age] AS
    MEDIAN(
    [Placement Dimension].[Id Removal Episode Fact].Members,
    [Measures].[Age At Removal Months]
    This median naturally represents the half-way point in the series of values. My analysts have also requested
    median-type values at the quarter and three-quarter points in the same series. I've been able to accomplish this for the three-quarter point by nesting the TopCount function in the set expression of the Median function to limit the set to the last half of
    the records and then find the median point like this:
    MEMBER Measures.[75th Percentile] AS
    MEDIAN(
    TOPCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    However, my attempt to use the BottomCount function in the same way as TopCount to find the quarter point
    in the whole data set by limiting the calculation's set to the first half of the data always returns null. Here is how I've formed the code:
    MEMBER Measures.[25th Percentile] AS
    MEDIAN(
    BOTTOMCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    And here is the query that returns the values:
    SELECT
    Measures.[Episode Count]
    ,Measures.[Median Age]
    ,Measures.[25th Percentile]
    ,Measures.[75th Percentile]
    } ON 0
    ,[Date Begin].[Calendar Hierarchy].Year.&[2011]:[Date Begin].[Calendar Hierarchy].Year.&[2014] ON 1
    FROM [POC Cube]
    WHERE
    [Age at Removal Mos].[Age in Years List].[Age Year].&[0]:[Age at Removal Mos].[Age in Years List].[Age Year].&[5]
    I don't know why the end result is always null. I don't have any null values in the data for this measure, and I know what values I should be seeing because I've found the median records manually in results from a SQL Server query. I've tried using TopCount
    and multiplying Measures.[Age At Removal Months] in the TopCount function by -1 to workaround the descending sort, but I still get nulls. I've also tried separating these queries out so the quarter point and three-quarter point calculations aren't run together,
    but I still get nulls for the quarter point calculation.
    I'm open to any help fixing this situation by modifying my current code or by using alternate methods, but the end result has to be dynamic enough to be used as a calculation in the cube. Thanks!

    The links might helps.
    http://technet.microsoft.com/en-us/library/ms144864.aspx
    http://www.mssqltips.com/sqlservertip/3034/sql-server-analysis-services-ssas-2012-top-and-bottom-functions/
    http://www.sqlservercentral.com/blogs/bradleyschacht/2012/03/12/mdx-functions-bottomcount/

  • Date calculation script

    Hi,
    I need to calculate difference between two dates. I believe that i should use function @DATEDIFF to perform such a calculation.
    But the problem that one of the dates calculated by such a script:
    i=@TODATEEX("Month dd yyyy",@CONCATENATE(@CONCATENATE(@NAME(@CURRMBR("Current Period"))," 01 "),@NAME(@ALIAS({RTP_Year}))));
    i=(@DATEPART(i,DP_YEAR)*100 + @DATEPART(i,DP_MONTH))*100+ @DATEPART(i,DP_DAY);
    This script returns first day of currently selected month and planning period (RTP_Year - financial year).
    And when i try to perfom calculation between variable i and member i ends whith error. Could you suggest something?
    I also tried some work arounds suggested in other threads but whithout success. I use 1.1.2.1.

    Hi,
    Try this:
    Re: Days behaviour between two dates
    Cheers,
    Alp

  • Date calculations based on working days

    I need to add date calculations to a worksheet to show the time elapsed between two actions.
    Just a straightforward subtraction works fine, but what I really need to be able to do is calculate the number of working days between the two point (as something taking 5 days over Christmas with the 2 bank holidays is different equivalent to something taking 3 days in a normal week)
    At the moment I'm exporting the data into excel for analysis of this, but would really like to be able to do it in Disco so that the end users can go straight to the report using viewer, rather than having to do the conversion for them.
    Is this possible?
    Cheers

    Hi,
    Every thing is possible, the Q is how complicated is it....
    My suggestion is to create a table with all the dates of the non-working days for ex:
    create a table with all the MON-THURSDAYS, union to this table the holidays you know of such as christmas and so on.
    After getting this table you can create a function that returns the number of working days between 1 date to another by subtracting the days exists in this table.
    I started with that, you are more then welcome to get ahead with it and let us know what happened...
    create table holiday
    D_date date,
    d_day varchar2(20)
    create or replace procedure holiday_proc is
    d_date date;
    begin
    d_date := trunc(sysdate);
    while d_date<'01-jan-2010'
    loop
    if to_char(trunc(d_date),'Day') not in ('Saturday ','Sunday ') then
    INSERT INTO Holiday (d_date,d_day)
    (select trunc(d_date),to_char(trunc(d_date),'Day') from dual);
    end if;
    d_date := d_date+1;
    end loop;
    commit;
    end holiday_proc;

  • I've installed iPhoto11 and when opening for the 1st time it says that needs to upgrade my library and it is doing this since yesterday. Is this right??

    I've installed iPhoto11 and when opening for the 1st time it says that needs to upgrade my library and it is doing this task since yesterday. Is this right??

    No. Quit and try again. If that fails again,
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • ExecuteScalar returns System.Decimal or System.Double on diff Oracle srvrs

    Hi,
    Oracle Data Provider for .NET Developer's Guide states that Oracle type NUMBER maps to .NET type System.Decimal.
    In my application I would like to retrieve value from database using simple query and OracleCommand.ExecuteScalar method. The problem is that on one database ExecuteScalar returns a value of type System.Decimal and on the other a value of type System.Double. Table creation script and C# code are shown below.
    Since I declared column as NUMBER without any precision or scale, I wonder if there is a setting that specifies default values on Oracle server? If I declare column as NUMBER(38) I get the same result (System.Decimal) on both databases. But I would not like to change table creation scripts.
    Oracle.DataAccess.dll (9.2.0.2102)
    Database 1 (returns System.Decimal)
    Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
    PL/SQL Release 9.2.0.2.0 - Production
    CORE     9.2.0.2.0     Production
    TNS for Compaq Tru64 UNIX: Version 9.2.0.2.0 - Production
    NLSRTL Version 9.2.0.2.0 � Production
    Database 2 (returns System.Double)
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    PL/SQL Release 9.2.0.4.0 - Production
    CORE     9.2.0.3.0     Production
    TNS for Compaq Tru64 UNIX: Version 9.2.0.4.0 - Production
    NLSRTL Version 9.2.0.4.0 - Production
    Database scripts:
    CREATE TABLE TEST_TABLE (ID NUMBER NOT NULL) LOGGING NOCACHE NOPARALLEL;
    ALTER TABLE TEST_TABLE ADD (CONSTRAINT PK_TEST_TABLE PRIMARY KEY (ID));
    INSERT INTO TEST_TABLE ( ID ) VALUES (1);
    COMMIT;
    C# code:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    namespace TestOracle
         class MainRun
              [STAThread]
              static void Main(string[] args)
                   if (args.Length != 1)
                        Console.WriteLine("usage: TestOracle.exe DSN");
                        return;
                   string dsn = args[0];
                   OracleConnection connection = null;
                   OracleCommand cmd = null;
                   try
                        connection = new OracleConnection(dsn);
                        connection.Open();
                        cmd = new OracleCommand();
                        cmd.CommandText = "SELECT ID FROM TEST_TABLE";
                        cmd.CommandType = CommandType.Text;
                        cmd.Connection = connection;
                        object retVal = cmd.ExecuteScalar();
                        Console.WriteLine(retVal.GetType().FullName);
                        connection.Close();
                   finally
                        if (cmd != null)
                             cmd.Dispose();
                        if (connection != null)
                             connection.Dispose();

    There was a fix on the database side that caused this behavior change but this was by design and intended. An event was also introduced as part of this fix so that this fix could be enabled or disabled on the database side. Please refer to the doc for more information.
    ODP.NET has worked around this behavior change in ODP.NET itself so that the behavior is consistent between different database versions. Next release of ODP.NET would have this work around.

  • AW DataBase Date Calculation

    I've tinkered a little and even searched the forum for some clues but had no luck.
    I'm interested in calculating the number of months that have elapsed between two dates. Could someone help me figure out the calculation field that would do this?
    Here is an example:
    Field 1 = 4/5/06
    Field 2 = 8/10/06
    Calculation field = 4.17 (4 months + 5/30 days)

    Hi Stephen,
    The basic unit of time in AppleWorks (and on the Mac clock) is the Day.
    If you specify a 'month' as a 30 day period, the calculation becomes trivial:
    Field 1 = 4/5/06
    Field 2 = 8/10/06
    Calculation field formula: ('field 2'-'Field 1')/30
    Result: = 4.23 (127 Days)
    Alternate:
    You can achieve the expected result (for your example) by defining a 'well-tempered' year of 12 equal months and 365 1/4 days:
    Calculation field formula: ('field 2'-'Field 1')*12/365.25
    Result: = 4.17
    But if you need to use calendar months, the question becomes complicated indeed.
    I (and a couple of others) spent a few months on creating an age calculation formula (years and months) a few years ago, which doesn't quite apply, so what follows should be considered a first draft (with notes).
    For two dates within the same calendar year, the difference in full months can be found using:
    MONTH('DATE2')-MONTH('DATE1')-(DAY('DATE1')>DAY('DATE2))
    MONTH(d) returns a number from 1 to 12, corresponding to the month of the date d.
    DAY(d) returns a number from 1 to 31, corresponding to the day of the month of the date d.
    The part of the formula following the second minus sign is a Boolean function that returns a 1 if the comparison is TRUE or a 0 if the comparison is FALSE. This subtracts 1 from the result of the first part of the formula if the first date is later in the month than the second.
    A complication enters if the two dates are not in the same calendar year (eg. November 17, 2005 and February 13, 2006).
    But time and other duties press. More later.
    Regards,
    Barry

  • Bug: 1st Date value returned from CF function as an Array

    I am encountering an annoying behavior in Flex.  I call a CF function to return a query into an arraycollection - very basic.  If the SELECT statement in the CF function includes any dates as returned values, the first date in the SELECT statement comes back into Flex as an array object that includes all of the fields in the query.  The other dates are returned normally as Date data types.
    This started happening a month or two ago, and I've reproduced it on several machines.  Needless to say, it is causing numerous errors when my code excpects a Date and gets an Array.
    Do you have any ideas of what might be causing this and what I can do about it?
    Thanks!!

    I'm not sure where to post it, but here are some snippets:
    in the cfc, I have a function as such:
    <CFFUNCTION name="GetPersonLog" returntype="query">
        <CFARGUMENT name="STUDENTID" type="numeric" required="Yes">
        <CFQUERY name="qry" datasource="#connection_string#">
            SELECT tblStudentLog.STUDENTLOGID, tblStudentLog.STUDENTID,
            <!---GETDATE() AS TESTTHIS,--->
            tblStudentLog.LOGDATE,
            tblStudentLog.LASTUPDATED,
            tblStudentLog.LOGENTRY
            FROM  tblStudentLog LEFT OUTER JOIN
            tblStudentDiscipline ON tblStudentLog.StudentDisciplineID = tblStudentDiscipline.StudentDisciplineID
            WHERE tblStudentLog.STUDENTID = <CFQUERYPARAM value = "#studentid#">
            ORDER BY tblStudentLog.LOGDATE DESC
        </CFQUERY>
        <CFRETURN qry>
    </CFFUNCTION>
    You see I have a REMmed out line to get a test date.  If I check the results in CF using cfdump, all dates come back as dates.
    In flex, the handler for the call to this function is simple:
            private function PersonLogHandler(event:ResultEvent):void{
                personlog = event.result as ArrayCollection;
                CursorManager.removeBusyCursor();}  
    If I stop the code here and evaluate the results in debug mode, I find that the LOGDATE result is an array of values, while the LASTUPDATED field is a date.
    If I put back the GETDATE() AS TESTTHIS, statement in the cfc function, then the result includes LOGDATE as a date object, but now the TESTTHIS result is an array.
    I have experienced this on 2 different machines, and it has brought my development to a standstill.  I can't thin of what changed to start these problems, except that I am now using the FlashPlayer 10 (with debugger).  This happens in Firefox and IE.  I am using FlexBuilder 3 and Coldfusion 8.

  • Date Calculations - Adding 1 to the day and adjusting month/year

    Hi all,
    I have a date field in MM/ DD/ YYYY format. If I add 1 to the DD (day) field, and I hit the end
    of the month/year I need to adjust the MM and YYYY accordingly.
    Is there is an existing class/method in the JAVA API that would handle somthing like this??
    If so , I can't find it..... I don't want to re-invent the wheel creating a Date Handling routine just
    for this program.......
    Thanks very much

    This is overkill... (and sorry that this post is over a year later than the original post... hopefully somebody will benefit from it :)
    Calendar.getInstance() by default instanciates a GregorianCalendar
    object. (check the src).
    Therefore:
    Calendar cal = Calendar.getInstance();
    cal.setTime(d); // where d = java.util.Date or java.sql.Timestamp
    cal.add(Calendar.DATE, numberOfDays);
    return cal.getTime();
    public static java.util.Date
    adjustDateBy(java.util.Date d, int numberOfDays) {
    java.util.GregorianCalendar cal = new
    java.util.GregorianCalendar();
         cal.setTime(d);
    cal.add(java.util.GregorianCalendar.DATE,
    numberOfDays);
         return cal.getTime();

Maybe you are looking for