Second difference between dates GMT?

Hello

I need to get the second difference between a date later GMT and current date of GMT.

My code looks like this:

Calendar futureDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));futureDate.set(Calendar.YEAR, 2009);futureDate.set(Calendar.MONTH, 11);futureDate.set(Calendar.DATE, 12)futureDate.set(Calendar.HOUR, 10)futureDate.set(Calendar.MINUTE, 43)futureDate.set(Calendar.SECOND, 18);

int secs = (futureDate.getTime().getTime() - System.currentTimeMillis()) / 1000;

This code gives me 12 hours too many seconds. I'm I have GMT + 7 time zone. DateTime, the value source Blackberry.

When I debug, and print the futureDate, it shows me my timezone instead of GMT.

Another weird thing. If I subtract the TimeZone.getDefault () .getRawOffset () in my calculation of seconds, the seconds are then 7 hours in advance. Where are these 5 hours from extra?

Thank you.

Sorry, just a little chip, I don't have the time to carefully review your problem (maybe do later) but two things:

(1) System.currentTimeMillis () returns the time UTC.  I think that CMJ is incorrect when he says that it returns local time.

(2) GMT is NOT necessarily UTC time on the device.  GMT in London at the present time is UTC to 1, because we (I'm in the United Kingdom) use Daylight Saving.  If you want to discover the real hour GMT, on the device or the Simulator, set time GMT from Casablanca.

I need to check these, do not have the time, but here are some other thoughts on the top of my head.

(a) timezone "GMT" is, in fact, Casablanca GMT, i.e. not affected by Daylight Saving.

(b) Note When you specify the time of the calendar, there are two forms of time:
TIME - what you used, can be morning or afternoon

HOUR_OF_DAY - which I think is what you should use.

So change your code to use HOUR_OF_DAY, and I suspect that this could work.  But as noted, just off the top of my head...

Tags: BlackBerry Developers

Similar Questions

  • code succcessive to genereate difference between dates in a table

    First create and insert statements;
    create table schedule(iloan_code number , schedule_date date);
    
    insert into schedule values(1001, to_date('01-jun-2012'));
    insert into schedule values(1001, to_date('01-jul-2012'));
    insert into schedule values(1001, to_date('01-aug-2012'));
    insert into schedule values(1001, to_date('01-sep-2012'));
    insert into schedule values(1001, to_date('01-oct-2012'));
    commit;
    The output of the table of the ANNEX should be now like this:
    ILOAN_CODE     SCHEDULE_DATE
    1001              01-JUN-12
    1001              01-JUL-12
    1001              01-AUG-12
    1001              01-SEP-12
    1001              01-OCT-12
    We want an additional column by name as well as the existing columns DAYS that would be the difference between dates.

    First line should be the difference between sysdate as well as the date of June 1, 2012 and successive lines must be the difference between successive calendar date

    For example in the second row the DAYS column should represent the difference between 1 July 2012 and 1 June 2012 and so on for the following ranks too.

    We need get the result by a SELECT statement

    The output of the table in the ANNEX must be something like that.
    iloan_code      schedule_date     days     Logic which we need 
    1001     1-Jun-12     22     sysdate-1st June 2012
    1001     1-Jul-12     30     difference between 1st July 2012 and 1st June 2012
    1001     1-Aug-12     31     difference between 1st aug 2012  and 1st July 2012
    1001     1-Sep-12     31     difference between 1st sep  2012 and 1st aug  2012
    1001     1-Oct-12     30     difference between 1st oct 2012 and 1st sep 2012
    Please notify;

    Hello

    You can change the Hoek solution like this:

    SELECT    iloan_code
    ,             schedule_date
    ,             schedule_date - LAG ( schedule_date
                                , 1
                         , TRUNC (SYSDATE)
                         ) OVER (ORDER BY schedule_date)     AS days_between
    FROM      schedule
    ORDER BY  schedule_date
    ;
    

    If all schedule_dates will be after SYSDATE, then you need not the CASE expression to test if it is.
    The argument optional 3rd to LAG is a return value in case there is no previous line.

    Sri says:
    ... The output of the table in the ANNEX must be something like that.

    iloan_code      schedule_date     days     Logic which we need
    1001     30-Jun-12     07     sysdate-30June 2012
    1001     1-Jul-12     30     difference between 1st July 2012 and 30 June 2012 ...
    

    The difference between 30 June 2012 and July 1, 2012 is not only 1 day?

  • Difference between Date hh: mm

    Hello

    I'm having the following table, I want the difference between time in hh & another exit as hh: mm with rounded seconds.


    CREATE TABLE 'ITIP. "" TOTO ".
    ("N1" VARCHAR2 (100),)
    "T1D" THAT DAY.
    'T2D' DAY
    )


    Insert into FOO (n1, t1d and T2D)
    values ('TT', to_date (25 June 2012 10:46:56 ',' dd-mm-yyyy hh24:mi:ss'), to_date (25 June 2012 10:51:53 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('TT', to_date (25 June 2012 10:51:53 ',' dd-mm-yyyy hh24:mi:ss'), to_date (25 June 2012 10:51:57 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('TT', to_date (25 June 2012 10:32:06 ',' dd-mm-yyyy hh24:mi:ss'), to_date (25 June 2012 10:43:09 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('TT', to_date (25 June 2012 10:43:09 ',' dd-mm-yyyy hh24:mi:ss'), to_date (25 June 2012 10:53:09 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('UU', to_date (25 June 2012 10:46:56 ',' dd-mm-yyyy hh24:mi:ss'), to_date (June 25, 2012 21:44:39 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('UU', to_date (27 June 2012 10:51:53 ',' dd-mm-yyyy hh24:mi:ss'), to_date (June 27, 2012 11:46:10 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('UU', to_date (28 June 2012 10:32:06 ',' dd-mm-yyyy hh24:mi:ss'), to_date (28 June 2012 18:45:32 ',' dd-mm-yyyy hh24:mi:ss'));))
    Insert into FOO (n1, t1d and T2D)
    values ('UU', to_date (June 29, 2012 14:22:13 ',' dd-mm-yyyy hh24:mi:ss'), to_date (June 29, 2012 17:24:20 ',' dd-mm-yyyy hh24:mi:ss'));))
    commit;


    What is the result when we substract two dates?, as I want the difference between time in hh & another exit as hh: mm with rounded seconds.

    Please suggest a query for the same thing.

    Thank you

    Hello

    user12009546 wrote:
    ... What is the result when we substract two dates?

    This is the number of days between these two dates. You can convert than an INTERVAL, which is more like what you want, using NUMTODSINTERVAL:

    NUMTODSINTERVAL ( dt2 - dt1
                    , 'DAY'
                    )
    

    If you don't want that all the information, you can use SUBSTR or regular expressions to get only the part you want.

    I would also like the difference between the time in hh & another exit as hh: mm with rounded seconds.

    Please suggest a query for the same thing.

    If the difference will always be between 0 and 24 hours, then you can do something like diff_c below:

    SELECT       dt1
    ,       dt2
    ,       NUMTODSINTERVAL ( dt2 - dt1
                       , 'DAY'
                     )          AS diff_i
    ,       TO_CHAR ( ROUND ( TRUNC (SYSDATE) + (dt2 - dt1)
                           , 'MI'
                     )
                , 'HH24:MI'
                )               AS diff_c
    FROM      toto
    ;
    

    Output:

    DT1                 DT2                 DIFF_I                         DIFF_
    ------------------- ------------------- ------------------------------ -----
    25-06-2012 10:46:56 25-06-2012 10:51:53 +000000000 00:04:57.000000000  00:05
    25-06-2012 10:51:53 25-06-2012 10:51:57 +000000000 00:00:04.000000000  00:00
    25-06-2012 10:32:06 25-06-2012 10:43:09 +000000000 00:11:03.000000000  00:11
    25-06-2012 10:43:09 25-06-2012 10:53:09 +000000000 00:10:00.000000000  00:10
    25-06-2012 10:46:56 25-06-2012 21:44:39 +000000000 10:57:42.999999999  10:58
    27-06-2012 10:51:53 27-06-2012 11:46:10 +000000000 00:54:17.000000000  00:54
    28-06-2012 10:32:06 28-06-2012 18:45:32 +000000000 08:13:26.000000000  08:13
    29-06-2012 14:22:13 29-06-2012 17:24:20 +000000000 03:02:07.000000000  03:02
    
  • Difference between Date of invoice and Date GL accounting Date Oracle AP

    Hello

    I have a question that might help a lot of people too late.
    I tried to run these queries
    Select aia. INVOICE_ID
    of AP_INVOICES_ALL aia, aida AP_INVOICE_DISTRIBUTIONS_ALL
    where aia. INVOICE_ID = aida. INVOICE_ID
    and aia. INVOICE_DATE <>aida. ACCOUNTING_DATE

    Select aia. INVOICE_ID
    of AP_INVOICES_ALL aia, aida AP_INVOICE_DISTRIBUTIONS_ALL
    where aia. INVOICE_ID = aida. INVOICE_ID
    and aia.GL_DATE <>aida. ACCOUNTING_DATE

    I see that there are a lot of results for these queries, where the Date of the invoice is not equal to the posting date and of the GL_Date of an invoice does not match the posting date in the distribution table.
    So, what is the difference between these dates.
    And if I had to take the date of posting of the invoice of the document, the date on which I have to take for these invoices in AP

    Thank you
    Bob

    Hello

    Date of GL:

    The date used to determine the right time of accounting for the transactions of your invoice and payment of GL. You assign a GL Date on your invoice during invoice entry
    and your payments during the creation of payment.

    Date of invoice:

    The invoice date that you assign to an invoice, you enter in Payables. Accounts payable uses this date to calculate the invoice due date, the terms of payment of the invoice. The invoice date may be the date of the invoice, or it can be another date that you specify.

    Posting date:

    The GL Date for distributions of the invoice. If you do not enter a value here or enter a value for GL Date when you submit Payables Open Interface Import, accounts payable will allocate a GL Date based on the GL Date set in the region of the invoice of the Payables Options window.

    Kind regards
    Rahul

  • time difference between dates

    I managed to present the session for the start date variable: CAST (VALUEOF (s_sd) AS DATE)
    and for the end date: CAST (VALUEOF (s_ed) AS DATE)

    How can I show the number of days of interval between them?

    Create an another session variable to calculate the difference between the dates.

    Select DATEDIFF (DD, "MM DD YYYY","MM DD YYYY") FROM DUAL;

    Hope that the question is answered.

    Update of the Post:

    The function datediff above would only work in SQL Server, if you use the oracle database, use the code below:

    SELECT SYSDATE - TO_DATE('20081205','YYYYMMDD') datediff FROM DUAL;

    Note: You can replace the sysdate with your custom date, but do not forget to mention the data format of date after the mention of the date of your custom.

    Thank you
    -Laurence.

  • To return the rows when there is a certain difference between dates

    Hello.

    I have a table called

    #president #.
    pres_name
    BIRTH_DATE

    and

    #winner #.
    name
    year_elected

    I wish I had all the presidents returned, who where under the age of 50 years when they elected.
    year_elected is only a 4-digit number; 1924 etc. While birth_date is 2001-01-01 etc.

    I have no idea how to make this work, ive tried substr and one things and a lot of other weird (prob wrong).
    select distinct p.pres_name, substr(p.birth_date, 0, 4), w.year_elected
    from president p, winner w
    where p.pres_name = w.name
    I did this witch query will show me all the presidents and their dates for the election and the date of birth. Now I just want something that returns only the guys where there is a difference in value 49 (?) between birth_date and year_elected


    Johan

    Edited by: user10248089 02-Oct-2008 00:42

    Based on information from Dave on presidents being elected the first Tuesday of November...

    SQL> with president as (select 'Bob' as pres_name, to_date('1/7/1934','DD/MM/YYYY') as birth_date from dual union all
      2                     select 'Fred', to_date('13/5/1950','DD/MM/YYYY') from dual union all
      3                     select 'Jim', to_date('21/12/1960','DD/MM/YYYY') from dual)
      4      ,winner    as (select 'Bob' as name, '1979' as year_elected from dual union all
      5                     select 'Fred', '2005' from dual union all
      6                     select 'Jim', '2000' from dual)
      7  --
      8  select p.pres_name, p.birth_date, w.year_elected
      9        ,trunc(months_between(next_day(to_date('01/11/'||w.year_elected,'DD/MM/YYYY'),'TUE'),birth_date)/12) as age
     10  from president p join winner w on (p.pres_name = w.name)
     11  /
    
    PRES BIRTH_DAT YEAR        AGE
    ---- --------- ---- ----------
    Bob  01-JUL-34 1979         45
    Fred 13-MAY-50 2005         55
    Jim  21-DEC-60 2000         39
    
    SQL>
    

    And the WHERE clause can be applied based on the same calculation as described in the age column

  • Difference between dates

    11.2.0.4

    not just a simple less question.

    Having a job of populating a table, table has several fields, 1 field is a date stamp

    create table t1

    (date of col1,

    lotsofcols varchar2 (100))

    Work is essentially a

    Insert into t1 (sysdate, 'somedata');

    Work can run hundreds of times per minute, I need to know when something happens when labour has not filled the table within a certain time, the time is different during the day, but if I get it working for a minute away its fine.  I only need to run hourly check.   So I want to select in the table all records during the preceding hour, then select the next inserted row, fewer dates and check whether it was more than a minute.   I can tell you that in a few ways, but the main SQL is what Im in trouble with.    I don't have a sequence number of the table.

    drop table t1;

    create table t1

    (date of col1,

    col2 varchar2 (10));

    -run 4 times this

    Insert into t1

    values (sysdate, 'abc');

    -run once to get a tape with a gap of 10 minutes

    Insert into t1

    values (sysdate + (10 / 24 / 60), 'abc')

    commit;

    -all records in the last hour

    Select *.

    from t1

    where col1 > (sysdate - (24 / 60))

    COL1 COL2

    ------------------- ----------

    30/01/2015-10:46:07 abc

    30/01/2015-10:46:08 abc

    30/01/2015-10:46:10 abc

    30/01/2015-10:46:12 abc

    30/01/2015-10:56:16 abc

    I want to select col1 4th row rank 5 col1, rank 3 rank col1 col1 4 etc, if the gap is greater than 60 seconds, then return - something, maybe an additional column of an instruction box

    Select *.

    from (select col1

    col2

    lag (col1) on prev_col1 (order by col1)

    , numtodsinterval (col1 - gal (col1) (col1 order), 'DAY') diff

    from t1

    )

    where diff > numtodsinterval (1, 'MINUTE')

  • Differences between Data Pump and always by inheritance, import and export

    Hi all

    I work as a junior in my organization dba and I saw that my organization still uses legacy import and export utility instead of Oracle Data Pump.

    I want to convence my manager to change the existing deal with Oracle Data Pump, I have a meeting with them to keep my points and convence them for Oracle utility pump data.

    I have a week very convencing power but I won't miss to discover myself, I can't work myself and really a need with differences of strength against import and export, it would be really appreciated if someone can put strong points against Oracle Data pump on legacy import and export.

    Thank you

    Cabbage

    Hello

    a other people have already said the main advantage of datapump is performance - it is not just a little more fast exp/imp it is massively faster (especially when combined with parallel).

    It is also more flexible (once much more) - it will even create users with exports level schema which imp can't do for you (and it is very annoying that he could never).

    It is reusable

    It has an api plsql

    It supports all types of objects and new features (exp is not - and that alone is probably reason to spend)

    There even a 'legacy' at 11.2 mode where most of your old exp parameter file will still work with him - just change exp expdp and impdp print.

    The main obstacle to the transition to datapump seems to be all "what do you mean I have to create a directory so that it works", well who and where is my dumpfile why can't it be on my local machine. These are minor things to go well beyond.

    I suggest do you some sort of demo with real data of one of your large databases - do a full exp and a full expdp with parallel and show them the runtimes for them to compare...

    See you soon,.

    Rich

  • Groovy Script to find the difference between Dates

    I am trying to build a script that takes a date from a RequestField and calculates the number of days between this date and the current date (from session).

    So far, I have a problem, the analysis to-date from the RequestField chain. I found this code but it doesn't seem to work...

    date = new Date().parse('yyyy/MM/dd', '1973/07/09')
    

    I get the following error...

    Error Message: groovy.lang.MissingMethodException: No signature of method: java.util.Date.parse() is applicable for argument types: (java.lang.String, java.lang.String) values: {"yyyy/MM/dd", "1973/07/09"}
    

    Any help would be greatly appreciated.

    Hello

    What version of server? The extract you have here works fine on mine (563).

    This also works for me

    new java.text.SimpleDateFormat('yyyy/MM/dd').parse('1973/07/09')
    

    See you soon

    Nils

  • How to make the difference between data (different sensors and actuators) is tans/recvd using series com

    Hello

    I get 2 different types of data from the controller. How to differentiate b/w them.

    After receiving my code in deccissions. There are 6 different control elements in my project attached to the controller. Thanks for give me idea how I send data to the controller for this controller to differentiate that exit to be active or low

    First, look at the couple of serial examples that come with LabVIEW. You use the VISA functions to read and write. Your technique to separate the values will work as well in LabVIEW. You would be to convert the string returned by VISA reading to a digital (i.e. with the Scan of the chain). Then do the comparison, then the result of wire to one of the two indicators. Put the terminal of each indicator inside a case statement would be a way to do it.

  • BlackBerry Z10 difference between guest and the data service

    Hi all

    new user of the Z10, his job very well, I just had a small problem or issue. What is the difference between data services being on vs calls in roaming? I usually use wifi, but often the mode invite, can't do the acquisition of internet connection, even though I have the data service and a G full download available.

    Any help would be greatly appreciated!

    See you soon,.

    Excellent!

    Thanks for the reply "prompt"!

  • Differences between HA solutions

    Could someone explain the differences between Data Guard, Oracle Streams, and Golden Gate? One or two sentence will be enough.

    For comparison between Eve and streams, see MOS study between Oracle Streams and Oracle Data Guard (ID 300223.1)

    Water course has three phases: capture data to redo, to propagate data and apply the data on the destination. All these three work at the database level.

    Golden gate has three steps: Capture and delivery Manager. The capture is known as excerpt from process. the spread (delivery) of the data and apply data (manager) are carried out at the level of the BONE.

    but I still don't understand the differences between streams and the Golden Gate. Both are Oracle products and looks to do the same.

    Golden gate was a third-party solution for replication, which was recently taken over by Oracle Corp.
    (A very less amount of available on this article)

    Kind regards
    S.K.

  • difference between standard and non-standard

    Is there a difference between data standardized and not standardized? If there is, what is it?

    If I have understood the question, there is no difference between "nomalized' and 'not normalized. Based on the convenience is to denormalize the people change the words, the technical term.

    For more information search google on the denormalization, tons of items awaits you.

    -Madan

  • Date difference between the Date of end of first row and the Start Date of the second row

    Hello

    I have data as follows:
    Seq_No      Plant_No      Start_date          End_Date
    148          A124         13/Jul/10           12/Oct/10
    210          A124         13/Oct/10           09/Jan/11 
    In the real world scenario, there would be more lines.

    I would like to take the difference in date between front-line end_date and start_date to second line.

    How can I do this?

    Concerning

    Published by: user400 on November 7, 2010 08:46

    I'm guessing you want something like

    SELECT seq_no,
           plant_no,
           start_date,
           end_date,
           lead(start_date) over (partition by plant_no order by start_date) start_date_of_prior_row,
           end_date - lead(start_date) over (partition by plant_no order by start_date) diff_in_days_btw_rows
      FROM your_table
    

    Justin

  • What is the difference between the external SCSI cables and cables data acquisition

    Hi all, I would like to make a simple extension using an external SCSI cable and a NOR 184749/SH 6868. In other words, it would be: female HD68 bolt of the cable ends OR coupled to an external SCSI HD 68 male with a VHDCI 68 male cable. What are the differences between the external SCSI cables and cables as the (M) 6868EP of the CHS data acquisition. Other than the sex of the end of HD68 is usually on one. How is the posting hit buy using an external SCSI cable for an extension to tell a BNC-2090?

    Yes, I realize that NEITHER wants us to buy their cable, but in these economic times difficult, to do use all available resources, so I have to try,.

    Thank you

    joelowwatt

    Hello

    As long as you have compatible connectors, SCSI cables will work DAQ of basic functions.  They have the advantage of NO cables is that we can meet our DAQ hardware.  So, we can create pairs twisted differential pairs to HAVE, using the ground for shielding terminals and generally specialize the cable to minimize noise and crosstalk.  Because the SCSI cables are not specialized, you are likely to see the most noise and, if you go the sampling rates more Rapids, crosstalk.  If you are in a laboratory or factory with a good amount of noise EMF that your readings are not quite as clean, or if you have fluorescent lights you might see 60 Hz noise you might not see otherwise.

    If you want more details on the specifications of the SH68-68-EPM cable, I recommend these two articles.  The first example of the twisted pair and the principles of the SH cable shielding and the second gives the most precise specifications that you can compare with when looking for a SCSI cable.

    3GRD4C33 Knowledge Base: mapping list of the sons of SHC68-68-EPM & SH68-68-EPM cable

    1TGEHPDM knowledge base: detailed specifications for the SH68-68-EP cable

    Kind regards

Maybe you are looking for