How can we get current time date with resultset?

Dear All,
I have to insert current time date in the table.So,i need to get the current time and date with result set.So,I will first get the time date and then insert it into the table.
I know how can we get current time and date without resultset.i have created this function its working.But now i want to use this.mean using resultset i want to put in the table.
How can i do this?
public static String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
public static String now() {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
}

yuck. Why not simply set a "new java.sql.Date()" to the SQL parameter in question?

Similar Messages

  • How can i get current time of a given timezone

    how can i get current time of a given timezone
    for example: Asia/Hong_Kong
    my code is like this, but the result is not correct.
    what's wrong?
    import java.util.*;
    public class test {
    public static void main(String[] args){
              String s = "Asia/Hong_Kong";
              String tempS = "";
              TimeZone myTime = new SimpleTimeZone(s);
              //TimeZone myTime = TimeZone.getTimeZone(s);
              Calendar myCal = new GregorianCalendar(myTime);
              tempS = myCal.get(Calendar.YEAR)+"-"+
                        (myCal.get(Calendar.MONTH)+"-"+
                        myCal.get(Calendar.DATE)+" "+
                        (myCal.get(Calendar.HOUR)+":"+
                        myCal.get(Calendar.MINUTE)+":"+
                        myCal.get(Calendar.SECOND);
              System.out.println(tempS);
    output is : 2001-7-15 11:16:48
    but the correct time should be: 2001-8-16 7:17:48
    the correct time should be 2001-8-16

    Certain indexes in the Calendar API start at 0 rather then 1, so, when you get the value, you may want to increment.
    I'm not sure why the time is incorrect. You may want to call getAvailableIDs() and make sure that the desired TimeZone ID is supported by your version. I doubt that Sun would have incorrect support for the time zone, but it may not be included, or perhaps it is included with a diffrent ID. You can always create your own time zone as well, by passing the String offset to getTimeZone(), the offset being how many hours beyond or before GMT. Hopefully this helps.

  • How can i get current time in different TimeZone

    Hi alls,
    How can i get current time in different TimeZone.
    I've tried
    final Calendar calendar = Calendar.getInstance(GMT0_TIME_ZONE);
    final Date date = calendar.getTime();
    but it returns current time in my time zone not in GMT0

    a simple way would be:Sometimes gets you the right result (not during daylight saving), but always the wrong way.
    I would strongly recommend getting into the habit of handling Dates correctly. A Date is a universal instant in time - the number of milliseconds since midnight GMT on 1 January 1970. That instant corresponds to various dates and times, depending on your time zone and the effect of daylight saving. You make that conversion of a universal instant to a localized date/time using Calendar and DateFormat.

  • How can i get the time detail with messageDateField ?

    Is there any common way of getting the time info with messageDateField ? As far as i research, there is no way of adding the time support of messageDateField such that it can be enabled by setting a parameter to true like getTime="true". Thanks.
    Fatih ER

    Sebahattin,
    You can display the time component by adding the timeStyle attribute:
    <onSubmitValidater>
    <date dateStyle="shortish" timeStyle="short" />
    </onSubmitValidater>
    Unfortunately, in the current release, when you save the date, the time will be lost. We have fixed this for the next release. As a work around, you can continue the route you have chosen with a separate time field.
    To get the time value in your entity object you can add a transient attribute "time" to both your VO and EO. In the UIX page, you create a field with the same name and set persistent="true". Now, the JHeadstart save process will simply send the time field to your EO through your VO, and you can use it to add the time component to your date field.
    Steven davelaar.

  • How can i get the time to appear on my stored data in notepad

    Hi all,
    I was wondering how can i get the time to appear on my stored data in notepad? I saw an example before but i forgotten which example was it.. Any ideas??
    holla
    Attachments:
    TextFile1.txt ‏3 KB

    Hi
    Im using Labview 8.2. Currently it just shows the data without the time. Im not sure what to do. It works perfectly though. I just want the time to appear on my notepad along with my data
    holla
    Attachments:
    Testing1.txt ‏1 KB
    Untitled 231_LV80.vi ‏23 KB

  • I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date is created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date  created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    The Finder reports File information. The date and time of the photo are in the Photo's Exif metadata. The Finder has no awareness of this. All photos apps on any system do.
    Regards
    TD

  • How can I get the time in Microsecond with JNI ?

    How can I get the time in Microsecond with JNI ?

    JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceFrequency (JNIEnv *env, jobject obj) {
         LARGE_INTEGER lFrequency;
         ::QueryPerformanceFrequency(&lFrequency);
         return (jdouble)lFrequency.QuadPart;
    JNIEXPORT jdouble JNICALL Java_Win32Native_queryPerformanceCounter (JNIEnv *env, jobject obj) {
         LARGE_INTEGER lpCounter;
         ::QueryPerformanceCounter(&lpCounter);
         return (jdouble)lpCounter.QuadPart;

  • How can i get back my data after i restored my iphone and accidentally created a new iphone ac.

    how can i get back my data after i restored my iphone and accidentally created a new iphone ac.
    it did a back up when i started my restored iphone and i cant retrieve my previous backup while i didnt back up on icloud....
    the new ac is actually the same apple id as the one i used. I lost all my contact, photos and data of whatsapp...
    what can i do...help!

    I don't know if this is a similar problem but I wrote 2 notes yesterday on my iphone. I opened my mail to print them and they appeared as notes but wouldn't load. Then I looked at them on my iphone and I could see the notes but they quickly updated to blank with a time of the last edit the same time I tried opening them on my computer.
    Yesterday I updated to 4.3.4  I don't know if somehow that affected them. Are they stored somewhere else. Can I get them back?

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How can I get a time stamp on text message without turning on "read"???

    How can I get a time stamp on text message iPhone 5 IOS 7? (Without having to send read receipt)

    You can make the "Visit Date" column visible in the Bookmarks Manager (Library) via "Views > Show Columns"
    * Bookmarks > Organize Bookmarks
    *http://kb.mozillazine.org/Viewing_the_browsing_history_-_Firefox

  • How can I get the system date in mm/dd/yyyy,

    how can I get the system date in mm/dd/yyyy, i need to compare system date with some other date,continuosly using threads,can U plz help me.
    With Some code
    Thanks In advnace
    Mahiiii

    Hi,
    You can use SimpleDateFormat class under java.text package.
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy h:mm a z", new Locale());
    //formatter.setTimeZone(timezone);
    String dateTime = formatter.format(new Date());

  • How do I get a time stamp with EACH text message?

    How do I get a time stamp with EACH text message?

    Wow finally! It's nice to see Apple finally provided something as simple as a time stamp.
    Now if they would only put in an Auto Retry for text messaging I would be all set
    Does anyone use the current Android OS? Does it have an auto retry function?

  • How can i get the time and result together show in one Array or in Cluster?

    hello everyone i am a new user .I want to get the time and voltge form a Generater. How can i get the time and result together show in one Array or in Cluster?When i selecte the first(or third...) result then in the front panel display the time and the voltge.Thank you!
    I post the time and voltge NOT together photo
    Attachments:
    12345.GIF ‏54 KB

    You can create an array of clusters with one element being the time and the other being the voltage, like so (using the "Get Waveform Components" function):
    Message Edited by smercurio_fc on 10-17-2007 03:15 PM
    Attachments:
    pic.PNG ‏11 KB

  • How can I get my Time Capsule to show up in finder?

    How can I get my Time Capsule to show up in finder?

    An alternate, and simpler method for most users is to open any Finder window, then look for the Time Capsule icon under the Shared heading on the left side of the window.
    When you click on the Time Capsule icon, a folder......named "Data", unless you have changed the name of the drive.....will appear to the right.
    Double-click "Data" to mount the Time Capsule drive on the desktop, where you can now drag/drop or copy/paste data to the drive.
    If the Time Capsule does not appear under the Shared heading when you open a Finder window......then you are likely using the Yosemite operating system on your Mac, and it will take some work to find it.
    In that case, Niel's method might be the better way to go.

  • I have new 2T iomega external HD (Mac Companion) - my Mac (2.8 GHz i7 - Lion OS) will not recognize HD if hooked up with Firewire, but it does recognize if hooked up via USB - how can I get it to recognize with Firewire?

    I have new 2T iomega external HD (Mac Companion) - my Mac (2.8 GHz i7 - Lion OS) will not recognize HD if hooked up with Firewire, but it does recognize if hooked up via USB - how can I get it to recognize with Firewire?

    Try a different FW800 cable and also try doing a SMC reset. If neither work try another FW800 device to see if it's recognized, if it is then  you know it's not the Mac it's probably the EHD.
    SMC RESET
    Shut down the computer.
    Unplug the computer's power cord and all peripherals.
    Wait 15 seconds.
    Attach the computers power cable.
    Wait another 5 seconds and press the power button to turn on the computer.
    PRAM RESET
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.

Maybe you are looking for

  • SAP is not coming up after installing Java Add-in

    Hi, I have installed a Java Add-in for an existing ABAP system. At the stage of "start J2EE engine" it is throwing an error message saying that Java is not coming up after 1142 seconds. I checked config tool and it is working fine. I restarted SAP. A

  • I cant restart my MacBook pro

    When I switch on my MacBook pro, it tries to load the operating system but after some seconds the MacBook pro switch off. I can t get in to my desk.

  • Where are still frame captures saved?

    When I do a Shift-E to do a still frame capture and export, Premiere Pro cs6 simply saves the current showing frame somewhere. Where is this file saved? Shouldn't there be a dialog box that comes up to show where you might want save the file? This is

  • Lightroom printing problem

    I am encountering an issue while printing from Lightroom ( I recently upgraded from Lightroom 4 to Lightroom 4.4) to an Epson Stylus Pro 3800. Using Epson 13 x 19 paper, and printing an image that should be 11 x 18, the result is a portion of the ima

  • G500 fan slow/ overheating? Power Manager- where is it?

    Hi everyone, My fan appears to be on a low setting, and I want to be able to turn it up as the base is quite warm. I suspect this mainly because when I put my hand near the cooling vent there seems to be less air coming out of it than before, I'm not