How to get current system date and store in db

may i know how to get the current system date so that i can store it into the database

java.util.Date is NOT deprecated, just most of its methods are.
Use
new java.sql.Date(System.currentTimeMillis());to get the current date. Note that the date in a client machine
may differ from the clock of the server!
BTW: java.sql.Date extends java.util.Date.
Fritz

Similar Messages

  • How to get the system date and time using java

    hi,
    I want system date in my out put. how to access system date. can v use utill packaegs (or) sql. which one is the best to get.
    Thanks & Regards,
    Kenny.

    import java.util.Date;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    public class MyClass {
    public void setTimeStamp() {
    int hour, minute, second, time = 0;
    Date dt=new Date();
    System.out.println(dt.getDate());
    System.out.println(dt.getMonth());
    System.out.println(dt.getYear());
    Calendar cal = new GregorianCalendar();
    hour = cal.get(Calendar.HOUR_OF_DAY);
    minute = cal.get(Calendar.MINUTE);
    second = + cal.get(Calendar.SECOND);
    System.out.println (hour + ":" + minute + ":" + second);
    public static void main (String args[]){
    MyClass app = new MyClass();
    app.setTimeStamp();
    }

  • How to get current row data in table control

    Hi , expert ,
       I am professional in oracle ,  but  now I am a new guy in SAP ABAP .
    I  have a question in UI
    How to get current row data and click pushbutton  in table control  to open next screen ?
    I want to get the current data and open next screen to carry out detail detail .
    Thansk for all your suggestion .

    GET CURSOR LINE SY-CUROW .
      READ TABLE internal_table index SY-CUROW.

  • I need to get the Current System Date and time in the format

    I need to get the Current System Date and time in the format
    *6/24/2009 11:30:29 AM*
    How do i do it ?

    I seem to be saying this a lot lately.
    Google is your friend.
    I googled "java current date format" and SimpleDateFormat featured prominently in the results.

  • How to get both OTF data and spool at a time

    Hi Experts,
        My requirement is to get both OTF data and spool.
    In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    I was able to get OTF data but spool is not getting generated.
    IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
    when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    the spool is generation is getting supressed.
    Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
    The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
    Please suggest me how to get both OTF data and spool at a time.

    Hi Kartik,
    This one is similar to my question to print and email invoice at same time.  I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
    Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
    itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
    Can you give me a working example that you have otfdata table and print data from that table.  I also post my question on other thread
    submit report and export to memory
    thanks

  • Display current system date and time in a form

    Hello experts from around the world,
    I have this little minor challenge that i am having difficulty cornering.
    I have a form and i want to display the current system date and time so that when i save the form its saves it with the date displayed.
    I have tried sysdate, &sysdate and &sysdate. in the default part with static text with sessions state submissions.
    So any help or suggestions would be of great help :)
    Thanks

    hi kevin
    write the below script in HTML header.
    <script type="text/javascript">
    <!--
    var d = new Date();
    var curr_hour = d.getHours();
    var curr_min = d.getMinutes();
    document.write(curr_hour + " : " + curr_min);
    </script>
    it will give the time u can assign this variable to text box item variable.
    or else check the below java script link
    http://www.mcfedries.com/JavaScript/datetime.asp
    cheers,
    Shan

  • How to access current system date???

    Hi Experts,
    I am working on a process wherein a user creates a proposal and a notification is sent to the manager for approval.
    Now i need to send the date of creation as a attribute to the manager.
    Can anyone guide me as to how to get the current system date???
    Thanks a lot.
    Cheers
    Gaurav Raghav

    Hi Wojciech Matulewicz,
    I have tried using this before and i faced this problem.
    When i click on create proposal, the screen just refreshes and the CO execution doesnt ends.
    Without ending this field, however things work fine.
    here is the code:
    Method technicalDescription()
    IGPAttributeInfo date = output.addAttribute("DATE", IGPAttributeInfo.BASE_DATE);
                date.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_1_1);
    Method execute()
    Date currDate = new Date(System.currentTimeMillis());
              contextElement.setDate(currDate);
    Method complete()
    output.setAttributeValue("Date", wdContext.currentContextElement().getDate());
    If i comment out this code, the CO execution works out fine, but on addition of this code the screen refreshes and CO execution doesnt end.
    Am i doing something wrong???
    please help me out with this.
    Thanks.
    Cheers
    Gaurav Raghav

  • How to get the client date and time ?

    Dear Sirs...
    Using jdeveloper 10.1.2.0
    How can i get the client date and time using the HttpServletRequest ?
    thanks for any help in advance
    best regards

    If your code is running on the client pc you can just create a new instance of the java.util.Date class. That class automatically defaults to the current time of the client machine. Otherwise if you're running the code on the server, you could insert/post the client date/time by adding its string representation as a parameter to the HTTP request object.
    Ronald

  • How to get the system date format string?

    Hello, everybody!
    I want to create a MaskFormatter with a mask for dates. So, I could suply as the constructor parameter: "##/##/####'. However, what if the year comes first in the current system date format settings, or the month is in the second place or in the first?... So, I can't just suppose that the current locale format for dates is like the one above. So, my question is: is there a way to get the SYSTEM DATE FORMAT STRING in Java? Searching in google I saw that this was already asked in this forum:
    http://forum.java.sun.com/thread.jspa?threadID=301034&messageID=1193794
    but there was no effective answer. Does someone already know how to get this?
    Thank you.
    Marcos

    Hi, not sure, but
    import java.text.*;
    SimpleDateFormat sdf = new SimpleDateFormat();
    System.out.println(sdf.toPattern());
    will output something like dd/MM/yy HH:mm
    hthThank you very much. It worked.

  • How to get the system date as a session attribute?

    Hi all,
    How can i get the system time and date to a session?
    This is my code:
    String startDate=<How will i get (system date) here?>;
    session.setAttribute("startDate",startDate);
    String startTime=<How will i get (system time + 1hr) here?>;
    session.setAttribute("startTime",startTime);
    Thanks in advance,
    Lakshma

    This is one way:
            Calendar cal = Calendar.getInstance();
            SimpleDateFormat sd1 = new SimpleDateFormat("yyyyMMdd");
            System.out.println(sd1.format(cal.getTime()));
            SimpleDateFormat sd2 = new SimpleDateFormat("hh:mm:ss");
            cal.add(Calendar.HOUR, 1);
            System.out.println(sd2.format(cal.getTime()));

  • How to display current system Date in the Date Input field ?

    Hi,
    I am having a Date Input field( binded to Data type). On load, i would like to display the current system date filled in that input field.
    How do i achieve this ?
    Reg/Venkat

    Hi Venkatesan,
    In your view in your init() method add the following code:
    wdContext.currentContextElement().setOrderDate(new Date(System.currentTimeMillis()));
    this is if your Date-attribute is in the root of the context.
    else you have to set the date in the node where the date-attribute is present with:
    IYOURNODEElement node = wdContext.createYOURNODEElement();
    node.setOrderDate(new Date(System.currentTimeMillis()));
    regards,
    Björn

  • How to get last modified date and time of a file which is in apache server.

    Hi ,
    I need to get last modified date and time of a file in remote machine.
    This file is in remote machine which has apache server installed.
    I am trying to get this information by connecting to apache server from client by giving absolute URI of the file to file object.
    URI is got from apache server URL by using toURI method.
    when I use lastModified method , its throwing exception , because scheme of URI is not file.
    I can't give scheme as file because ftp server is not installed on that server
    Is there any other way to get this information .

    No, unless you can use an FTP client.

  • How to get (old)previous date and create a loop?

    Hi!!!
    I am using java.util.date object.
    I need to get the 2 months back date,i.e. 60 days back date and to create a loop from that date till today and add it to combobox.
    Suppose today's date=3-12-2001
    x=date-60=3-10-2001
    and wants to create a loop from 3-10-2001 till today to display it in a combobox.
    Please tell me how can I do it?

    try the below which will print the date form 60 days before(from today) to todays date
    import java.util.Calendar;
    import java.util.Date;
    public class RandomNumber
         public static void main(String args[])
              RandomNumber rn = new RandomNumber();
              rn.printDate();
         public void printDate()
              Date todayDate = new Date(System.currentTimeMillis());
              Calendar calendar_ = Calendar.getInstance();
              calendar_.setTime(todayDate);
              calendar_.add(Calendar.DAY_OF_YEAR, -60);
              for(int i=0;i<60;i++)
                   System.out.println(calendar_.getTime());
                   calendar_.add(Calendar.DAY_OF_YEAR, 1);

  • How to get current system icon theme

    Hello every one.
    I need to create an ImageIcon object and set it's image to a folder icon image suitable with the current System ( i.e. Vista, XP, ... )
    So, I was wondering how can I get the icons of the system themes?
    any advice will be appreciated.
    thank you.

    Swing related questions should be posted in the Swing forum.
    set it's image to a folder icon image suitable with the current System You can get some Icons from the UIManager. Check out [UIManager Defaults|http://www.camick.com/java/blog.html?name=uimanager-defaults]. Start with the "FileView".
    You can also get the icons of specific applications using something like:
    (((ImageIcon) FileSystemView.getFileSystemView ().
        getSystemIcon (new File ("c:\\windows\\explorer.exe"))).getImage ());

  • How to get Default (System) Date Format Pattern?

    How to get system default date format which is defined in Regional Setting of Control Panel.
    We can get an instance of DateFromat using DateFormat.getDateInstance(DateFormat.SHORT) but problem is that there is no toPattern() exist in class DateFormat.
    However toPattern() exist in class SimpleDateFormat but there is no costructor like SimpleDateFormat(DateFormat)
    So please advise me, how can I get system short date format pattern?
    Thanks
    GAJESH TRIPATHI

    I reterieve the system date format but not which is currently defined in regional setting of control panel but it returns the format which is installed by default when windows(os) is installed.
    Edited by: gajesh on ? ????????, ???? ??:?? ?????????
    Thanks to provide me solution. My source code related problem is solved but still I am not getting format which is defined in control panel. but By Letting that it is not possible in Java,... I am doing my next work...so CLOSE THIS TOPIC Thanks'n Bye.

Maybe you are looking for

  • Local Repositories Vs. Tunnelled access to a remote DB ?

    Environment: Running Oracle BI 10.x on <local_server> Windows XP Running Analytics on Windows Exporer Hosting target Postgres DB <my_db> on remote server <remote_server> Set up tunnel to remote server using PuTTY Goal: Get Analytics and Oracle BI Adm

  • Reversal of the Payment Run

    Dear Forum, The users have made the Payment Run thru T Code F110, which is comprising of large number of Invoices. However, due to error at the bank side during file upload, we need to reverse the transactions. Is there a way to reverse the payments

  • Looking for best way to filter status or meter data from differently formatted text.

    With the product we design we are able to communicate via RS-232 ports. What I'm trying to do is filter out the data that is given by multiple differnt types of products that will give similar data back, but in a differnt format. Such that in a statu

  • Time reporting periods that won't close.

    Hi, We have recently installed PPM 2013.  We are able to close time periods in the future but cannot do it for one in the past.  I click the SAVE button and nothing happens.  No confirmation and no error message.  When I move to another page, the bro

  • How to run a jms-class as a stand-alone java-Programm???

    Hi, I have another little question concerning jms. The jms programs I have written so far had to be executed as application clients using the appclient-tool. I asked myself, if it is possible to run a class that uses jms like a normal java-Programm w