Difference between 2 dates in milliseconds

Hi all,
I need to create a timestamp of difference in milliseconds
between the date and time now and 00:00:00 01/01/1970.
I am currently using:
<cfset timeStamp = dateDiff("s",
createDateTime(1970,01,01,00,00,00), REQUEST.dateTimeNow)*1000>
but that gives me a value of 1.170170719E+012; however I
require a string containing 13 numeric characters.
Any advice appreciated.
Thanks,
Paul

Paul / Adam,
Thank you for your replies.
> The DIFFERENCE between two dates is *not* a timestamp.
It is just a value.
> I presume what you want is the NUMBER of milliseconds
since 0:00 1/1/1970.
Yes, that is true. I am integrating the HSBC card payment
interface and the name of the variable they are requesting is
"timeStamp". I must have just used that as a description of what I
was after rather than just the name.
> "Determines the integer number of units by which date1
is less than date2".
>
> dateDiff() will not do units of milliseconds, but it
will do seconds. And
> there's 1000ms in a second.
So <cfset timeStamp = dateDiff("s",
createDateTime(1970,01,01,00,00,00), REQUEST.dateTimeNow)*1000>
should tell me how many seconds there are between 00:00:00 on
01/01/1970 and the current date and time, then the *1000 should
tell me the value in milliseconds?
I have spoken with HSBC and they tell me that the specific
value they are looking for from the timestamp is 13 numerical
characters (e.g. 1170185487375), but the value being returned from
my cfset above is 1.170170719E+012, which includes non numerical
characters.
The HSBC payment server is on a Linux server and my host is
Windows. Are there any differences in the formatting of such a
string?
I cannot see anything I have missed on this.
Any other suggestions?
Thanks,
Paul

Similar Messages

  • Difference between two dates in seconds/milliseconds with Expressions

    Hi,
    I need to write a query using Expression(Builder) which calculates the difference between two columns (date/timestamps). As of other requirements I am not able to use JPQL, so I tried to create the query with the Expression framework. The difference between the two dates can be calculated with the
    ExpressionMath.substract(...)
    method. The result is a Date-like object storing the difference between both dates. But how can I cast this difference to a long or something like this with expressions?
    Thanks,
    Thomas

    Date functions are very database dependent, as each database has its own set of functions for processing dates.
    The functions are defined in the Expression class, you can try,
    truncateDate, roundDate, or datePart
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#truncateDate(java.lang.String)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#roundDate(java.lang.Object)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#datePart(java.lang.String)
    James : http://www.eclipselink.org

  • Getting the difference between 2 dates

    Hi,
    I am creating a Date object (using today;s day, month and year. hours and minutes come from a config file) and getting the difference between this date and the current date and time.
    My code is as follows:
    I am passing 07:30 into the method as the parameter aSstart_time.
    Calendar newCalendar = Calendar.getInstance(Locale.UK);
        SimpleDateFormat dtformat = new SimpleDateFormat("dd-MM-yy HH:mm");
        int lIYear = newCalendar.get(newCalendar.YEAR);
        int lIMonth = newCalendar.get(newCalendar.MONTH);
        int lIDay = newCalendar.get(newCalendar.DAY_OF_MONTH);
        String lSstartHrs = aSstart_time.substring(0,aSstart_time.indexOf(":"));
        //System.out.println(">>>>>>>>> THE HOURS IS: " + lSstartHrs);
        String lSstartMins = aSstart_time.substring(aSstart_time.indexOf(":")+1,aSstart_time.length());
        //System.out.println(">>>>>>>>> THE MINS IS: " + lSstartMins);
        java.util.Date ldStartTime = new java.util.Date(lIYear,lIMonth,lIDay, Integer.parseInt(lSstartHrs),Integer.parseInt(lSstartMins));
        System.out.println("Year: " + lIYear);
        System.out.println("Month: " + lIMonth);
        System.out.println("Day: " + lIDay);
        System.out.println("Hour: " + Integer.parseInt(lSstartHrs));
        System.out.println("Min: " + Integer.parseInt(lSstartMins));
        System.out.println("The number of milliseconds for current time is: " + newCalendar.getTime().getTime());
        System.out.println("The number of milliseconds for 07:30 is: " + ldStartTime.getTime());
        System.out.println("calendar time: " + dtformat.format(newCalendar.getTime()).toString());
        System.out.println("created time: " + dtformat.format(ldStartTime).toString());
        if(newCalendar.getTime().getTime() < ldStartTime.getTime()){
          System.out.println("The current time is less than the config time (07:30)");
        else{
          System.out.println("The time is greater than 07:30");
        }When I run this program at 10:06am I get the following output:
    Year: 2006
    Month: 1
    Day: 15
    Hour: 7
    Min: 30
    The number of milliseconds for current time is: 1139997962321
    The number of milliseconds for 07:30 is: 61098132600000
    calendar time: 15-02-06 10:06
    created time: 15-02-06 07:30
    The current time is less than the config time (07:30)
    The Date.gettime() method should measure the number of milliseconds after 01-01-1970 so the number of milliseconds for the current time (10:06am) should be greater than the number of milliseconds for 07:30. A you can see in the above output this is not the case.
    Anybody have any idea why this is happening. Am I using the .gettime() method for the correct purpose.
    Any ideas or suggestions would be greatly appreciated.
    Thanks

    It is beacause Calendar use fully defined year as parameter, so Calendar.set(year + 1900, month, date, hrs, min) is (almost) equivalent to new Date(year, month, date, hrs, min)Example:    int year = 85; // old way of specifying a year in a Date
        int month = 3;
        int date = 12;
        int hrs = 12;
        int min = 0;
        Calendar cal = Calendar.getInstance();
        cal.set(year + 1900, month, date, hrs, min);
        Date d = new Date(year, month, date, hrs, min);
        System.out.println(d);
        System.out.println(cal.getTime());You will obtain the same date (except seconds and miliseconds in this case, as they probably won't be zero with Calendar.getInstance(); )

  • Calculate difference between two dates/times

    Hi all,
    Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
    I need to know how many millisconde(second,minutes, hours... )there is between these two times.
    Please, It is urgent
    Thank you all.
    Karim

    hi,
    try the following function
    CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'        
          EXPORTING                                  
               timestamp1 = timestamp1               
               timestamp2 = timestamp2               
          IMPORTING                                  
               difference = diff                     
          EXCEPTIONS                                 
               OTHERS     = 1. 
    the above function gives the difference in seconds...
    try the following  code to set the resolution to milliseconds..
    SET RUN TIME CLOCK RESOLUTION LOW
    check the thread for details:
    SET RUN TIME CLOCK RESOLUTION?
    all the best!!!
    Regards,
    Aparna

  • What is the difference between delivery date and actual goods issue date?

    Hi ,
    Can you please tell me the difference between Delivery date and Actual goods issue date ?
    Delivery data can be be greater than goods issue date?
    Thanks,
    Ajay

    Hi Ajay,
                  Delivery date means its the original date on which the delivery should be done.Actual goods Issue date is the date on which goods to be delivered according to the purchase order.There can be delay in the delivery so we maintain 2 objects.
    Yes delivery date can be greater than Goods Issue date.
    Hope this clears
    Regards
    Karthik

  • As to the data type of the data type of the difference between two date type of datas

    Hi,
    I have a question about the data type of the difference between two date type of datas.
    There are two date type of datas as:
    SSHIPMENTS.RECEIVEDATETIME
    SSHIPMENTS.PROMISEDATETIME
    I try to use the following SQL Script in Oracle SQL*Plus as:
    SELECT CASE
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:00:00.000' THEN 'OnTime'
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    The error message of "Invalid Number" for the '000 01:30:00.000' happens.
    I don't know if the data type of the interval is wrong.
    Many Thanks,
    Cathy

    SELECT CASE
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss')) < '010000' THEN 'OnTime'
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss'))< '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    just try it out..

  • Difference between Invoice Date, GL Date and Accounting Date Oracle AP

    Hello,
    I have a question that might help a lot of people too later.
    I tried to run these queries
    select aia.INVOICE_ID
    from AP_INVOICES_ALL aia, AP_INVOICE_DISTRIBUTIONS_ALL aida
    where aia.INVOICE_ID = aida.INVOICE_ID
    and aia.INVOICE_DATE <> aida.ACCOUNTING_DATE
    select aia.INVOICE_ID
    from AP_INVOICES_ALL aia, AP_INVOICE_DISTRIBUTIONS_ALL aida
    where aia.INVOICE_ID = aida.INVOICE_ID
    and aia.GL_DATE <> aida.ACCOUNTING_DATE
    I can see that there are lot of results for these queries, where the Invoice Date is not equal to the Accounting date and the GL_Date of an invoice is not equal to the accounting date in the distributions table.
    So, what is the difference between these dates.
    And if I had to take the Invoice Accounting document entry date, which date do i have to take for these invoices in AP
    Thanks
    Bob

    Hi
    Let me try to explain this with an example.
    Suppose I buy some stationary from a vendor and he provides me with a detailed invoice of the goods puchased.
    In this case the invoice will always have a date printed on it and this date should ideally be entered in the invoice date at AP_INVOICES_ALL level.
    Now suppose the invoice happens to be received by me in february and for some reason I could not capture the invoice in my books in february and made a provision for the liabilities and close the books.
    However in march i want to book the invoice say on 10th of march in my books and pay the vendor the amount payable.(I Have to reverse the already provided liability in march to reverse the accounting effect).
    In this case my book entry date of invoice is the accounting date i.e. 10 March.
    In case of oracle, the accounting is maintained so that the invoice header hits the liability account while the invoice distribution hits the charge account(expense account so to say). And to gain more flexibility oracle provides date in both header and distributions to provide an option of booking liability and charge on different dates..
    As per the 11i checks there is no check on any of these dates except that accounting date at header and ditribution level must be in an open AP and GL period.
    Thanks
    MAV.

  • Difference between doc date,posting date and invoice date

    hi bw guys
    can someone give a brief on the difference between doc date,posting date and invoice date.and the invidual definitions
    thank you

    Hi,
    Posting Date: Date which is used when entering the document in Financial Accounting or Controlling. The posting date can differ from both the entry date and the doc date.
    Document Date: The document date is the date on which the original document was issued. Ex: Inv date, Bill date etc.,
    Invoice Date : Usually the date when goods are shipped. Payment dates are set relative to the invoice date.
    -Vikram

  • Difference between 2 Dates

    hi..Experts
    Req: In OBIEE,Difference between Start date and end date. Result should be in hh:mm:ss fromat
    I Tried with
    TIMESTAMPDIFF(SQL_TSI_SECOND, " Closed Date", "Scheduled Start Date")
    it gives me No.of Seconds.
    in Data format tab, custom= [FMT:Timestamp] then i am getting in hh:mm:ss tt fromat and the difference is incorrect
    i need format in hh:mm:ss
    Please give suggession......

    Hi User,
    Try this one
    Cast(TimeStampDiff(SQL_TSI_MINUTE,LAST_UPD,CUR RENT_TIME STAMP(0))/1440 as VARCHAR(10)) || ':' ||
    Cast(Mod(TimeStampDiff(SQL_TSI_MINUTE,LAST_UPD ,CURRENT_ TIMESTAMP(0))/60,60) as VARCHAR(2)) || ':' ||
    Cast(Mod(TimeStampDiff(SQL_TSI_MINUTE,LAST_UPD ,CURRENT_ TIMESTAMP(0)),60) as VARCHAR(2))
    Please note that the output of the Desired Format will be in VARCHAR.
    Thanks
    Don

  • Difference between Posting Date & Baseline date in MIRO

    HI,
    What is the difference between Posting Date & Baseline date in MIRO?
    Regards
    Chandan
    Edited by: Chandan H N on Dec 14, 2009 11:11 AM

    Dear,
    Posting Date:
    Posting Date in the Document
    Date which is used when entering the document in Financial Accounting or Controlling.
    Use
    The fiscal year and the period for which an update of the accounts specified in the document or cost elements is made, are derived from the posting date.
    When entering documents, the system checks whether the posting date entered is allowed by means of the posting period permitted.
    Note
    The posting date can differ from both the entry date (day of entry into the system) and the document date (day of creation of the original document).
    Baseline Date
    Baseline Date for Due Date Calculation
    Date to which the periods for the cash discount deadline and the due date for net payment refer. This is the case for line items in open item accounts.
    For line items in G/L accounts, the item is due immediately on this date because there are no cash discount specifications.
    Procedure
    During document entry for open item accounts, the date may be defaulted. For this, a terms of payment key must have been specified in the customer's/vendor's master record for which a default value is requested in the document.
    The proposed date can be overwritten.
    If the cash discount rates (and days) have not been entered, the baseline date for payment is the same as the due date.
    Regards
    Utsav

  • Differences between using Data Pump to back up database and using RMAN ?

    what are differences between using Data Pump to back up database and using RMAN ? what is CONS and PROS ?
    Thanks

    Search for Database backup in
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/backrec.htm#i1007289
    In short
    RMAN -> Physical backup.(copies of physical database files)
    Datapump -> Logical backup.(logical data such as tables,procedures)
    Docs for RMAN--
    http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmcncpt.htm#
    Docs for Datapump
    http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_overview.htm
    Edited by: Sunny kichloo on Jul 5, 2012 6:55 AM

  • How to build a difference between to dates

    Hi @All,
    Hope you can help me :) ..
    I'd like to build the "difference" between two dates (e.g. date of the invoice and date of the payment receipt). As the result I expect an Integer.
    I tried several functions and operations, but still get the error code: [nQSError: 22023] An arithmetic operation is being carried out on a non-numeric type.
    I also tried to cast the date format into an Integer or double, but I still get an error ...
    Here is my code:
    CASE WHEN "2_Forderungsstruktur_Fälligkeiten".DIM_DATUM_FAELLIGKEIT.DDAT_DATUM_DE < 0
    THEN NULL
    ELSE
    "2_Forderungsstruktur_Fälligkeiten".DIM_DATUM.DDAT_DATUM_DE - "2_Forderungsstruktur_Fälligkeiten".DIM_DATUM_FAELLIGKEIT.DDAT_DATUM_DE
    END
    Hope you guys have some good ideas to solve these problem :)
    best regards
    Matt

    hi,
    TIMESTAMPDIFF(SQL_TSI_MONTH,"Dim - Time"."Date",CURRENT_DATE)
    "Dim - Time"."Date"--->Column1
    Current_date--->Column2
    thanks,
    saichand

  • Calculating the difference between to dates.

    All,
    I've a requirement where I need to calculate difference between to dates. If the given date is less than the current date, it should return '0'(zero) other wise should return 1. How can i do this?
    Regards,
    Venky

    SQL> select decode(sign(sysdate-to_date('01/02/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2  from dual;
      DATECOMP
             0
    SQL> ed
    Wrote file afiedt.buf
      1  select decode(sign(sysdate-to_date('01/12/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2* from dual
    SQL> /
      DATECOMP
             1
    SQL> ed
    Wrote file afiedt.buf
      1  select decode(sign(sysdate-to_date('11/11/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2* from dual
    SQL> /
      DATECOMP
             0
    SQL>Edited by: BluShadow on Nov 11, 2008 1:27 PM
    couple of further examples.

  • Get Date Difference between 2 date values as days

    Hi,
    How to get the difference between 2 dates in number of days format. Say if i need the difference between 2012-08-23 and 2012-08-20 as 3
    Please help..

    Hi,
    You can do it in XSLT since the dates are in ISO 8601 format...
    http://www.w3.org/TR/NOTE-datetime
    Here is a sample XSLT...
    <xsl:stylesheet  version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:template match="/">
    <xsl:variable name="date1" select="xs:dateTime(/root/date1)"/>
    <xsl:variable name="date2" select="xs:dateTime(/root/date2)"/>
    <xsl:value-of select="fn:days-from-duration($date2 - $date1)"/>
    </xsl:template>
    </xsl:stylesheet>The above XSLT will result *4* for the following input...
    <root>
    <date1>2012-01-11T00:00:00.000-05:00</date1>
    <date2>2012-01-15T00:00:00.000-05:00</date2>
    </root>You can test this example here...
    http://xslttest.appspot.com/
    Hope this helps...
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • Date difference between two dates

    hi All,
    i have to right a stored proc to find the difference between two dates. 
    for example of i give
    startdate as 4/1/2015 and enddate 14/1/2015
    i should get 1 year , 10 days and 0 months .
    i have tried the DateDiff function but it does not calculate the leap year.
    please help.

    DECLARE @from datetime
    DECLARE @to   datetime
    SET @from = '20150104  8:00'
    SET @to   = '20150114  10:30'
    SELECT DATEDIFF(minute,@from, @to) % 60 as Minutes
    SELECT (DATEDIFF(minute,@from, @to) / 60) % 24 as Hours
    SELECT DATEDIFF(minute,@from, @to) / (60 * 24) as Days
    SELECT DATEDIFF(month,@from, @to) as Months
    SELECT DATEDIFF(year,@from, @to) as Year
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • Error in production environment

    Hi, We are getting Error in production following environment. Anyone knows the reason of error ? (internal)     06.25 06:43:40.779     IdcServerThread-751869     !csPageMergerUnableToGenerateHtmlPage!csSystemError,\!syServiceRuntime\,java.lang.IndexO

  • Tables for Generic datasource

    Hi experts, I want to create a generic data source related to purchasing for these fields.Anyone please provide me exact tables of these fields 1.MWSKZ     Tax code 2.KBETR     Condition amount 3.KWERT     Condition Value 4.SORT1     Search Term 5.SO

  • Converter for XviD?

    I wanted to convert some XviD video files to avi. After searching online, I downloaded a couple programs including handbrake, but each one diminishes the quality, which is out of my expectation. Is there any program that can convert xvid to avi witho

  • Mouse Cursor replaced by colorful box after 10.4.3 update

    Hello Everyone, I am not getting anyware with this problem and I am stuck with 10.4.2 as I am not able to update. Every time that a new update comes out I tried hoping that the problem has been addressed but in reality is not, and I need to rebuild.

  • [HELP] CRL in standalone OC4J SSL and ws-security x.509 token profile?

    Dear all, i have a question about setting up the OC4J server to check against a cert revocation list (CRL) when: 1. SSL in standalone OC4J (no oracle http server) (i.e. using secured-web-site.xml) 2. ws-security x.509 token profile (authenticate user