Problem converting Date time vanishes

Hi,
I am doing the following
String datstr = coform.getCourseDate();
LamLog.log(this,LamLog.INFO,"Date in insertRow is " + datstr);
LamLog.log(this,LamLog.INFO,"Date in insertRow sdf.parse(datstr) is " + sdf.parse(datstr));
java.sql.Date dt = new java.sql.Date(sdf.parse(datstr).getTime());
LamLog.log(this,LamLog.INFO,"Date after creating in insertRow is " + dt);
dt.setTime(sdf.parse(datstr).getTime());
LamLog.log(this,LamLog.INFO,"Date after conversion in insertRow is " + dt);
but the result I am getting is
Date in insertRow is 04/01/2003 09:30:00
Date in insertRow sdf.parse(datstr) is Tue Apr 01 09:30:00 EST 2003
Date after creating in insertRow is 2003-04-01
Date after conversion in insertRow is 2003-04-01
if you see after converting to sql.Date the time portion of the date vanishes. What is wrong??
Kindly help.
Regards
Rajesh J

But I need sql date to use in my entity beanjava.sql.Date doesn't have a time component. java.sql.Timestamp does. If your bean has been written to use java.sql.Date then obviously it doesn't need the time component.

Similar Messages

  • How convert date/time from xml in xdp(Designer)?

    Hi, i want to convert date/time format from xml in Designer, date/time value in xml is NOT in common format YYYY-MM-DD (if is in a common format i can do this with pattern)
    I have a "DateTime" Field in Xdp can get from Xml date and time:
    In XML <DateTime>DD-MM-YYYY</DateTime> i want to convert in XDP in DateTime Field in "DD-April-YYYY"
    Can i do this?

    You can do this way..
    Bind the date field to your XML tag.
    Set the display pattern for the date field.
    In the initialize event of the date field place the following code.
    Set JavaScript as language.
    var dtStr = this.rawValue;
    var pos1=dtStr.indexOf("-");
    var pos2=dtStr.indexOf("-",pos1+1);
    var strMonth=dtStr.substring(0,pos1);
    var strDay=dtStr.substring(pos1+1,pos2);
    var strYear=dtStr.substring(pos2+1);
    //Assign the formatted value to the Date field.
    this.rawValue = strYear + "-" + strMonth + "-" + strDay;
    Thanks
    Srini

  • FUNCTION MODULE TO CONVERT DATE / TIME INTO WORDS.

    HI EXPERTS,
         FUNCTION MODULE TO CONVERT DATE / TIME INTO WORDS.
    PLS DO HELP.....

    Hiii gita
    we have another FM SPELL_AMOUNT
    regards
    Jaipal

  • Convert date/time to a value in second

    Hello,
    I want to convert a basic date time variable into a numeric one corresponding to the time (in second) passed since January,1,1970 in order to put it in a SQL statment as a criteria.
    Is someone able to help me ?
    Regards

    If you have an java.util.Date object you can call getTime() method on it. It will return milliseconds. Just divide it on 1000. Here is example code:
    java.util.Date date = new java.util.GregorianCalendar(2001, 7, 6).getTime();
    long seconds = date.getTime() / 1000;
    //Your code
    Best regards, Alex.

  • How to convert date-time according to the Time Zone the client

    Urgent! Help wanted!
    I extract a date-time field (which is GMT time) from the central database but I need to convert it accordding to the TimeZone of the user and also the so-called winter time and summer time in the local. Any one has any good solution?
    Thanks.

    Use a Calendar, Timezone and Locale objects like this,
    TimeZone tz = TimeZone.getTimeZone("Germany/Berlin");
    Calendar cal = Calendar.getInstance(tz, Locale.GERMAN);
    long date = 0; // assign your central database value to this variable
    cal.setTime(new Date(date));
    Now you can use the Calendar object 'cal' to retrieve the time according to the set locale and timezone.
    These objects provide tonnes of features for finding out timezones and day light savings times. So check out the APIs as well.
    I hope this helps you out.

  • Convert date/time to Unix epoch

    I have thousands of date time stamps I would like to convert to Unix epoch ten-digit strings. That is, take some thing like:
    Dec 9, 2005 10:24 AM
    and convert to
    1234567890 (only in the correct unix epoch time)
    What formula can I use? I've found that this "=DATE(1970,1,1)+P2/86400" can convert a 10 string epoch time down to just a date correctly, but without time. But I need to go in the opposite direction, with the time included.
    Using Numbers 09 ver 2.0.5 (368)

    CP,
    An up-to-date Unix Time would be provided by:
    =DUR2SECONDS((NOW()-"1/1/1970"))
    A somewhat more robust form would be:
    =DUR2SECONDS(NOW()-DATE(1970,1,1))
    If the time to be converted is in Cell P2, the expression would be:
    =DUR2SECONDS(P2-DATE(1970,1,1))
    Jerry

  • Convert Data time stamp to Local Time

    Hello,
    I want to convert this input to local time EST.
    Input:12/8/2006 10:23:00.000000000 PM -06:00
    o/p: EST.Local Time

    Is the input a string? A timestamp? If so, which flavor of timestamp? Something else?
    Normally, you'd want to use a TIMESTAMP WITH LOCAL TIME ZONE data type for this sort of requirement, since it automatically converts data to the client's time zone. Assuming the input is a string and that the client's time zone is set to EST
      1  select cast(to_timestamp_tz( '12/8/2006 10:23:00.000000000 -06:00',
      2                               'MM/DD/YYYY HH24:MI:SS.FF TZH:TZM' )
      3                AS TIMESTAMP WITH LOCAL TIME ZONE)
      4*   from dual
    SCOTT @ nx102 JCAVE9420> /
    CAST(TO_TIMESTAMP_TZ('12/8/200610:23:00.000000000-06:00','MM/DD/YYYYHH24:MI
    08-DEC-06 11.23.00.000000 AM
    Elapsed: 00:00:00.01
    SCOTT @ nx102 JCAVE9420> Justin

  • Converting date time string to double data

    I have to plot a bar chart. The VI accepts only 2-d double data. My X- axis is date timestamp and Y- axis is the double data.
    Bt I am unable to convert the timestamp value to double.
    Anyone can suggest anything ?
    Regards,
    Runjhun.

    Thnx a lot Darin.
    Bt may be I should be more clear with my reqmts.
    In the image attached the data to be plotted is stored in Excel from LabVIEW.
    And the graph is plotted in Excel selecting the data.
    Plotting of graph is maual.
    I want that the graph plotting should be automatic.
    In RGT der's a function Excel Plot Graph bt the problem is dat it takes only 2d double array as I mentioned earlier.
    May be dis wil make my problem clearer.
    Regards,
    Runjhun A.
    Attachments:
    plot_type.jpg ‏3724 KB

  • Problem in  date & time

    Problem 1:
    i'm using date in midlet, but it does not give me the correct System time.
    Problem 2:
    the date field returns the date & time in milliseconds. how can i get the date in format 06 sep 2002.

    Hi,
    You can use the method System.currentTimeMillis(), that returns a long value that is your system's current time.
    DateField dateField = new DateField("Date", DateField.DATE_TIME);
    dateField.setDate(new Date(System.currentTimeMillis()));
    To get the day, month and year you can use the Calendar class.
    Calendar calend = Calendar.getInstance();
    calend.setTime(new Date(long yourdatemillis));
    So you can get the correct parameters by calling
    calend.DAY_OF_MONTH, calend.MONTH and calend.YEAR and appending it to a String and displaying it. But the day of month and month, i think, returns the correct value decreased of 1.
    Ricardo

  • Problem with Date & Time Auto Update

    Hi everyone,
    I have been experiencing a date & time issue with my MacBook Air. (I am running 10.5.5 with all the latest software updates except for iTunes 8). Here's what's going on:
    Under the Date & Time preferences, whenever I try to check the box for "Set date & time automatically", the date and time do not update. I thought Norton might be the culprit in this case, but I have thoroughly uninstalled it, and this problem still persists. (I am actually borrowing this laptop for work, so I don't know if someone else possibly did something weird to it before I started using it. As far as I can remember, I've always had this problem -- the automatic setting has never worked.)
    I am connected to the internet when I do this, and I already have my time zone selected. Am I missing something obvious here?
    I apologize if this issue has been brought up before, but I did a lot of searching and couldn't find anything. Any suggestions would be greatly appreciated!!
    Thank you.

    whenever I try to check the box for "Set date & time automatically"
    You check it and the time does not update, or you try to check it and it doesn't show a little tick mark?
    Try it with Console.app open and see does it report any errors. Try changing the time server.
    AK

  • Problem with Date / Time Title - Showing Inacurate Information

    I use iMovie to make videos for my job. The videos need to have an accurate running time and date displayed on them. I use the "Date/Time" Title option and the running time and date appear on the video. BUT- there is a problem. The time is wrong.
    When I import a video clip (from my Panasonic HDC-TM80) into iMovie, I can see the "time and date created" as well as the "length" of the video clip. The time and date created shows the time and date of when the clip ENDS. When I overlay the "Date/Time" Title, it starts the time (at the beginning of the clip) from the created time (which is actually the end).
    Example:
    Clip Created (end of clip): 3/23/11 10:30:00am
    Length of clip: 12 min. 35 sec.
    The actual Date/Time Title should show 10:17:25am at the beginning and runs through 10:30:00am (the end).
    But instead it shows 10:30:00am at the beginning and runs through 10:42:35am. This obviously results in a 12 min. 35 sec. inaccuracy.
    Is this a problem with the software? Is there a way to contact someone to alert them of this problem? Or am I missing something simple?
    Thanks in advance for anyone's help.
    -as a quick fix, I adjusted the time and date on the video clips so that it would show the correct info, but I'm usually working with several clips at a time and it is laborious to change each one.

    I don't have an answer but was wondering how you like the TM80? Except for the date/time issue, is it compatible with iMovie'11?
    Thanks!

  • I have got problem with "Date & Time"

    I have bought a new Macbook Air 13"
    I have chosen "set date & time auto..."
    However, it shows in up right corner wrong date. Also all mail, reminders and etc work with wrong date.
    Please, tell me what to do with this problem.
    Sincerelly,
    Mark

    Incorrect date or time displayed in various applications

  • Problem with Date/Time field in Adobe LiveCycle

    I am trying to create a form that has a check-in and check-out dates. I want the user to enter those dates and then have the form automatically compute how many nights the user intends on staying.
    I have two fields, CHECKIN and CHECKOUT, set up as text fields. My third field, NIGHTS, has the following script to do the calculation:
    var strStart = CHECKIN.rawValue
    var strEnd = CHECKOUT.rawValue
    if(strStart.length && strEnd.length)
    var dateStart = util.scand("mmm d, yyyy",strStart);
    var dateEnd = util.scand("mmm d, yyyy",strEnd);
    var diff = dateEnd.getTime() - dateStart.getTime();
    var oneDay = 24 * 60 * 60 * 1000;
    var days = Math.floor(diff/oneDay);
    this.rawValue = days;
    else
    this.rawValue = 0;
    NOW...this is fine if the user inputs a four-digit year. If not, it's trouble. SO, what I want to do is change the CHECKIN and CHECKOUT fields to the date/time field so they select the date off the pop-up calendar.
    When I make the changes, I can't get the script to work for the NIGHTS field.
    CAN ANYONE HELP THIS NEWBIE?

    Make sure the format of the date strings provided by the calendar is what you are expecting. Or use the "formattedValue" for the input strings.

  • Convert date time local Timezone  to GMT

    I need to get GMT time...
    How to convert local time to GMT ?
         public static long getGMTNow()
             Calendar local = new GregorianCalendar();
             local.set(Calendar.HOUR_OF_DAY, 0);              
             local.set(Calendar.MINUTE, 0);
             local.set(Calendar.SECOND, 0);
             System.out.println(local.getTime());
             System.out.println(local.getTimeInMillis());
             Calendar gmtC = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
             gmtC.setTimeInMillis(local.getTimeInMillis());
             System.out.println(gmtC.getTime());
             return gmtC.getTimeInMillis();
         }Result :
    Thu Feb 12 00:00:00 EST 2009
    1234414800034
    Thu Feb 12 00:00:00 EST 2009
    1234414800034

    Calendar gpsTime = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
             gpsTime.set(Calendar.HOUR_OF_DAY, 10);              
             gpsTime.set(Calendar.MINUTE, 0);
             gpsTime.set(Calendar.SECOND, 0);
             System.out.println("gpsTime: "+gpsTime.getTime());
             Calendar realtime= new GregorianCalendar();
             realtime.set(Calendar.HOUR_OF_DAY, 5);              
             realtime.set(Calendar.MINUTE, 0);
             realtime.set(Calendar.SECOND, 0);
             System.out.println("realtime: "+realtime.getTime());
             System.out.println("COMPARETO : "+ realtime.compareTo(gpsTime));
             long timediff = realtime.getTimeInMillis() - gpsTime.getTimeInMillis();
             System.out.println(timediff/1000 + " sec");RESULT :
    gpsTime: Mon Feb 16 05:00:00 EST 2009
    realtime: Mon Feb 16 05:00:00 EST 2009
    COMPARETO : 1
    0 secOk, I done my homework. getTime() will allways return local time so I need to set the GPS time to a GMT Calendar to get the right result.
    Funny thing, look at the compareTo result....

  • Convert date/time to HEX command and write to a bin file

    Hello,
    I have to do the following thing. I have the date/time string, let's say 08:45:23, 12.08.09, where the hour, the minutes, the seconds, the day, the month and the year represent hex number or in other words I have the following command:
    Byte 0 - Byte 5
    0x08; 0x45; 0x23; 0x12; 0x08; 0x09;
    Now I want to write this command in a binary file in order to send thefile later throught serial RS232 connection.
    Now, I am not sure whether I write the command in the binary file in the correct format. What I simply do is to write it as a string
    ("084523120809"). Is this the correct way. I guess no, because when transmitted it does not work as expected.
    How can I write this string as a HEX command in the binary file?
    Thanks for the replies in advance
    IG
    Message Edited by igurov on 08-12-2009 01:51 AM
    Attachments:
    1(2).JPG ‏39 KB

    Do you know the difference between decimal and hex values? It's not the same, that the whole point, and it's why it doesn't make sense. Decimal 32 is not the same as hex 32. These are two different values, even though they both have the digits "3" and "2". The hex value will be the same as the decimal value up to the value of 9. In your example the hour is 8. In decimal this is 8, in hex this is 8. The minutes is 45. That's decimal. In hex, this is 2D, not 45, as you claim in your example. Hex 45 is a completely different number (and a completely different "pattern").
    Attachments:
    time hex.vi ‏12 KB

Maybe you are looking for