Skip to Content
author's profile photo Former Member
Former Member

Date problem

Hi masters

I am here to ask you about a very insane problem.

I have a context attribute with Date type that ir populated with:

15 Oct 2010 00:00:00 GMT

this attribute are binded to a input field that displays the following date:

14-10-2010

but it should display 15-10-2010, isn´t it ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2010 at 07:58 PM

    Generally the problems we find are not insane; but rather reflects our own mistakes or misunderstandings or insanities.

    For example when its 14th of October in some countries, its the 15th October in other countries.

    You probably are displaying the date as per a timezone which finds itself in a different day to GMT at midnight in Greenwich.

    And there are a lot.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      As suugessted by poojith, you can refer following code to extract just date and not time ..

      // Get Vslue in String

      String startDate = 15...XXXXXX

      // Declare SimpleFomratDate

      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

      // Decalre java.util.Date

      Date sDate =dateFormat.parse(startDate);

      // Declare java.sql.Date

      java.sql.Date stDate = null;

      stDate = new java.sql.Date(sDate.getYear(),sDate.getMonth(),sDate.getDate());

      Regards,

      Jigar Oza

  • Posted on Oct 22, 2010 at 04:53 AM

    Hi,

    Try getting only the date and not the time. If you are getting this value from an RFC or any other source, then inform them to send the date without the time.

    This will work correctly

    Regards,

    Poojith MV

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.