How to get the today's julian date in java?

how to get the today's julian date in java?
hi can any one tell me how to get the todays julian date using Calender class or GregorianCalender class....
Julian date for 2006.November.01 AD 05:54 PM : 2454041.0
i have tryied with
calJ.setGregorianChange(new Date(Long.MAX_VALUE));
System.out.println(sdf2.format(calJ.getGregorianChange()));
thanks
Tushar
Message was edited by:
lad_tushar

thanks a lot....for intrest....
I have found some details about the Julian calendar as follows:
The Julian date for 2006: JAN: 01:12:01:59 is 2453737.00138
245 represent the year digits for year 2006
3737 represent the date fir 1 Jan
.00138 represents the time for 12:01:59
Julian date change as per every day 12 noon it increase one digit in it.
As per ref from
http://www.aavso.org/observing/aids/jdcalendar.shtml
Also chk this calendar where Julian date is 20. October 2006 for 02 November 2006
As per ref from
http://www.calendar.sk/julian_calendar-en.php
I have tried the pure �GregorianCalendar� class from jdk1.4 API and its setGregorianChange method but not getting as per the expected Julian date format. Using the �setGregorianChange()� i have setting the cutover date to Long.MAX_VALUE it means GregorianCalendar now have to act as per the Julian calendar ...so after setting the cutover date it return me changed date using �getGregorianChange()� but that was not the Julian date of the current date...as expected or as per above both scenario. Even though the last two digits are nowhere equal to the actual Julian date.
Program
GregorianCalendar cal = new GregorianCalendar();
cal.setGregorianChange(new Date(Long.MAX_VALUE)); // setting the calendar to act as a pure Julian calendar.
// cal.set(Calendar.DATE, new Date().getDate()); // seting the current date
// Date todayJD = cal.getGregorianChange(); // getting the changed date after the setGregorianChange
Date todayJD = cal.getTime(); // getting the calculated time of today�s Julian date
SimpleDateFormat sdfJulianDate = new SimpleDateFormat("yyDDD");
SimpleDateFormat sdfJuliandayOfYear = new SimpleDateFormat("DDD");
System.out.println("today Date = " + new Date());
System.out.println("Today as julian date = " + sdfJulianDate.format(todayJD));
System.out.println("Today as day of year = " + sdfJuliandayOfYear.format(todayJD));
OUTPUT:
USING : Date todayJD = cal.getGregorianChange();
Today Date = Thu Nov 02 15:17:05 IST 2006
Today as julian date = 94229
Today as day of year = 229
USING : cal.set(Calendar.DATE, new Date().getDate());
Today Date = Thu Nov 02 15:19:22 IST 2006
Today as julian date = 06319
Today as day of year = 319
USING : Date todayJD = cal.getTime();
Today Date = Thu Nov 02 15:17:59 IST 2006
Today as julian date = 06306
Today as day of year = 306
There is one another concept i found to get the Julian day of the year as per the Julian day chart mention on nasa site (http://angler.larc.nasa.gov/armsgp/JulianDayChart.html) and i m getting the moth of the year that is 306 for nov 02 2006 using getTime() method in above code then the out put is right for Julian day. But it was not as per the expected Julian date format. So in conclusion we can only able to retrieve the day of year for the Julian calendar. hope their will be a solution for this problem in java api ....else we allways have to depend upon the third party api that was not accepteble some times.....
Kindly chk chart on the site
http://angler.larc.nasa.gov/armsgp/JulianDayChart.html
http://weather.uwaterloo.ca/julian.html
http://www.fs.fed.us/raws/book/julian.shtml
Thanks,
Tushar Lad

Similar Messages

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • How to get the name of a Data Element of a generic Table!

    Hi guys!
    In my function i have the following import paramenter
    i_outtab type standard table
    now i import a table and i want to get the dataelement of the fields.
    is there a way to do this??

    Hello Thomas
    Perhaps the following sample report may be useful for you.
    *& Report  ZUS_SDN_RTTI_STRUCT_COMPONENTS
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145711"></a>
    *& Thread: How to get the name of a Data Element of a generic Table!
    REPORT  zus_sdn_rtti_struct_components.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES: bukrs    TYPE bukrs.
    TYPES: kunnr    TYPE kunnr.
    TYPES: END OF ty_s_outtab.
    DATA: gdo_data    TYPE REF TO data.
    DATA: gs_outtab   TYPE ty_s_outtab.
    DATA: go_typedescr  TYPE REF TO cl_abap_typedescr,
          go_structdescr  TYPE REF TO cl_abap_structdescr,
          go_datadescr    type ref to cl_abap_datadescr.
    DATA: gs_comp        TYPE abap_compdescr,
          gd_dtel        type string,
          gt_dfies        type ddfields.
    FIELD-SYMBOLS:
      <gs_struct> TYPE ANY.
    START-OF-SELECTION.
      BREAK-POINT.
      GET REFERENCE OF gs_outtab INTO gdo_data.
      ASSIGN gdo_data->* TO <gs_struct>.
      go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struct> ).
      go_structdescr ?= go_typedescr.
      BREAK-POINT.
      LOOP AT go_structdescr->components INTO gs_comp.
        go_datadescr = GO_STRUCTDESCR->GET_COMPONENT_TYPE( gs_comp-name ).
        gd_dtel = go_datadescr->get_relative_name( ).
        write: / syst-tabix, 'Data element =', gd_dtel.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • How to get the details of entry date in SQ00.

    Hello,
    Can anybody let me know the steps how to get the entry date in the report SQ00.Here when i am selecting entry date its coming as 00.00.00.(as zero).please let me know how to correct the steps with proper steps.

    Hi
    Apply the SAP NOTE 562031. This will rectify the error. I too faced similar problem which was then corrected when this Note was applied.
    Test it first an then let me know

  • How to get the ep user information data in the web dynpro?

    Hi all
      I want to create a web dynpro application on EP.I want to get the ep user information data in the web dynpro.How can I do?Thanks.

    Lin,
    Two steps to achieve this:-
    <b>Step 1:</b> Add the following code in your view Controller:-
    IWDClientUser user = WDClientUser.getCurrentUser();
    IUser objUser = user.getSAPUser();
    wdContext.currentContextElement().setXXXX(objUser.getUniqueName());
    wdContext.currentContextElement().setYYYY(objUser.getFirstName());
    wdContext.currentContextElement().setZZZZ(objUser.getLastName());
    where XXXX, YYYY , ZZZZ are the context names.
    getUniqueName : Gives Login id of Portal user.
    getFirstName : Gives First Name of the Portal user.
    getLastname : Gives Last Name of the Portal user.
    <b>Step 2 : </b>Use "Organize imports" and make sure that you have the following two libraries added in the build path of your project. You can do these by right clicking on your project name ==> Properties ==> Java Build Path ==> Libraries ==> Add External jars.
    The external jars are :
    <b>com.sap.security.api.jar
    com.sap.security.api.perm.jar</b>
    Finally rebuild your project and deploy.
    Regards,
    <b>Chintan Virani.</b>

  • How to get the difference of two dates?

    let's say i have a table named tblData and has 4 columns: data_RefNo, data_DateReported, data_TargetDate, data_Data
    tblData returns 2 rows.
    data_RefNo.............data_DateReported.............data_TargetDate........................data_Data
    10000................10-20-2004 10:55:44 AM........10-20-2004 10:57:44 AM........Slow Response Time
    10000................10-21-2004 10:55:44 AM........10-21-2004 11:55:44 AM........Bug Error
    i just wana ask how to get the difference of the date_DateReported and date_TargetDate.
    i tried this code but it didnot work
    public Vector get_con_pf()
      Vector vData = new Vector();
      String query  = "SELECT * FROM tblData WHERE data_RefNo= '"'10000'"'";
      try
        DBConnect db = new DBConnect();
        db.openCon();
        ResultSet rs = db.execute(query);
        while (rs.next())
          vData.addElement(DATEDIFF(mi, rs.getString("st_DateReported"), rs.getString("st_TargetFinishDate")));
        db.closeCon();     
      catch (Exception e)
        System.out.println("Error: " + e );
      return vData;   
    i want to return the difference of the data_DateReported and date_TargetDate, i did this
    vData.addElement(DATEDIFF(mi, rs.getString("st_DateReported"), rs.getString("st_TargetFinishDate")));but it didnot work.
    How do i get that? because i want to return a vector.
    the code must return the values:
    2 for the 1st rows because the difference is only 2 minutes, and
    60 for the 2nd row.

    ooops i tried this one:
    query = "SELECT *, DATEDIFF(mi, data_DateReported, data_TargetDate) AS diff FROM tblData WHERE data_RefNo = '10000'";and it works.
    hehehehe!!!!!!
    problem solved! :)

  • BPC - Script - How to get the month of a date stored as an amount?

    We have a account called "StartDate" in our database.
    The user enter a date for this account: 01/07/2010
    This date is then stored as 40360 in the db
    We are trying to get the month number (7) out of this record.
    We succeeded to write an sql query to do that:
    Select Month( cast( as datetime ) )
    From tblFact
    Where = 'StartDate'
    Any idea how to do that in a bpc script logic ?
    Thanks,
    Bénédicte

    There's no built-in support for any type of date math in BPC script logic.
    One approach I've used is to add a property to the time dimension, ExcelTimeID. Then you can compare the value to your time periods, if your logic requires this type of condition.
    *WHEN SignedData
    *IS < Time.ExcelTimeID
    But that doesn't solve the problem you have, where you want to know the month. I can't think of an immediate solution, other than perhaps in the original input schedule to hide a second account that submits the month number (as an integer) along with the account you have now (with the full date).
    Or stick a stored proc in some logic package, scheduled to run every 10 minutes or whatever, that takes the account with the date in it, and runs your query, saving the result as the month number. Ugly in so many different ways, but it's another way to tackle the problem further upstream.
    And last result is to build script logic with ridiculous hard-coding of Excel time IDs all over the place.

  • How to get the start time and date

    Hi everyone! I have a question ,who will be glad to help me! Thanks in advance!
    As we know ,when we finish the UUT test ,it generate report . The report format maybe like"SeqFileName_Report[Time][Date]_00001.xml"
    My question is"how can I get the [Time] and [Date] in the test sequence"

    See this post.
    How To Display Time Information in Report/Results?
    http://forums.ni.com/t5/NI-TestStand/During-a-test-how-can-I-find-the-start-time-and-date-of-that/td...
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How to get the difference between two date

    Hello,
    I want to know how to write a code the tell me the difference between two date, I am using
    oracle.jbo.domain.Date
    i have a rent date and return date so my code is
    Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
    is there a way to know the difference in days between those two dates ?
    Thanks

    hi,
    try this.....
    DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
    Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
    Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    Calendar calto = Calendar.getInstance();
    calto.setTime(dateto);
    fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
    toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
    // System.out.println("from Date : " + fromDate);
    if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {                  
    fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
    fc.renderResponse();
    thks.

  • OIM: How to get the last operation and data from a child form action

    Dear OIM guru,
    I have a regular Process form, a child form and a process definition. When there is an insert/delete into child form a trigger is raised and the process task gets called. The process task does whatever it needs to do on the target system. This is all fine. However, after the task completes, lets say successfully, I want to send out an email to the user saying, for example, group 1 has been added to you or just got deleted.
    I am not able to figure out how to get that last operation and child form data. I am sure you came across this and if so please let me know how to do this.
    Thanks

    So, Can I add a similar process task with the same exact condition one more time? I thought I couldn't use the same condition again. For example, when a group is deleted can I use the process data->child data->group Id with old value check box checked on another process task?

  • How to get the current month starting date and ending date by default ?

    Hello Creators,
    This is my requirement, kindly do the needful, Please dont gimme any links i've no access for other sites, gimme the right solution.
    My Requirement :
    Creation Date (VBAK-ERDAT) - Select Option. By default, the program should run for the current Month ie between the starting and ending date of the current month when the program is run. Today the date is 18th using sy-datum we can bring the current date by calling it in the initialization event, but the requirement is it should not give me the current date, it should only give me the month starting date and the end date. Kindly help.
    Thanks in advance ...

    DATA: gv_datum LIKE vbak-erdat.
    SELECT-OPTIONS: so_date FOR gv_datum.
    INITIALIZATION.
      CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
        EXPORTING
          iv_date             = sy-datum
        IMPORTING
          ev_month_begin_date = so_date-low
          ev_month_end_date   = so_date-high.
      so_date-option = 'BT'.
      APPEND so_date.
    START-OF-SELECTION.
    Hope this solves the issue. Don't forget to be generous
    Cheers,
    Sougata.

  • How to get the grn no and date

    Hi,
          from which table i can get the grn number(mblnr) and the grn date(budat).
    dinesh

    Hi,
    Try table
                    <b>MKPF  --  Header: Material Document
                    MSEG  --  Document Segment: Material</b>
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

  • How to get the 'th' when typing dates?

    Does anybody know how to make the 'th' or 'nd' small when typing a date in pages?
    I'm using pages 5.5.2 and can't seem to find how to do it anywhere.
    I would appreciate a quick response as I'm typing an urgent document.
    Thanks,
                Kevin

    Unicode does not have ordinals for numbers, only for the masculine and feminine.
    The reason being that each language has its own and the effect can be achieved with Superscripting.
    To superscript say st, nd or th select the characters > Menu > Format > Font > Baseline > Superscript
    or
    control command shift +
    Peter

Maybe you are looking for

  • How can I stop Firefox from blocking sites that do not supply ownership information?

    I am trying to access a website and I get a 400 Bad Request message. Further "research" leads to the "This website does not supply ownership information" message. I have cleared history and cookies, reloaded the page and followed all the answers give

  • Master Detail Relation

    Can I design Master detail using one block for master and display like 5 records and each of this has 10 detail records. I am not sure if I can achieve this. Other scenario is have one master block(5 records) and have 5 detail blocks. Please give any

  • Scanner/co​pier issues

    Hi, there.  My Photosmart C309g is totally outdated, and I know that, but it prints perfectly -- scanning and copying is where I'm having the issue.  For months now, anytime I scan (whether directly from the printer's screen or from the software) or

  • Oracle BI SE1 configuration for Finantial

    Hi, I am configuring Oracle BI Standart Edition one. My aim is to use it as reporting tool for EBS finantials. Please inform me, does BI SE1 provide a predefined model for EBS finantials, including cubes, dimensions, tables, mappings, etc? Does it co

  • DataGrid Headaches

    We have a serious issue when it comes to datagrids in Flex 2 and 3. Our datasource is a simple XML and what we are trying to do is display a checkbox in a datagrid that is binded to a node in the XML. For some reason, the checkbox cannot be binded ..