cancel
Showing results for 
Search instead for 
Did you mean: 

DATE

Former Member
0 Kudos

Hi Experts,

i'm having a problem with date

1.i created attribute called From of Type Date

2.Binded with input field

3.by default it taking system date month year ......dd-mm-yyyy......25-09-2008

My problem is

i want to set that date to some other DD-mm-yyyy 01-01-2008 plz give me some solution

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try this,

Calendar calendar = new GregorianCalendar(2008, 0, 1);

Date date = new Date(calendar.getTimeInMillis());

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

String formatedDate=f.format(date);

wdComponentAPI.getMessageManager().reportSuccess("the date"+formatedDate);

formatedDate will give 01-01-2008.

Regards,

ramesh

Former Member
0 Kudos

hi Ramesh

i tried with your code .....i got some what i expected but....................... i'm not having option to select any date from that month ........?.

what i'm expecting is ...i want to select any date from that month not exactly particular date that is 01-01-2008

That date field must start with 01-01-2008 ..... can we able to select any date in that month .......01-2008

Is it possible .....? please Give me some solutions

thank's and Regards

ram

i

Edited by: Ramprasad K on Sep 26, 2008 9:25 PM

vmadhuvarshi_
Contributor
0 Kudos

Ramprasad,

Did you try this..


public void wdDoInit()
  {
    //@@begin wdDoInit()
	  Calendar calendar = new GregorianCalendar(2008, 0, 1);
	  Date date = new Date(calendar.getTimeInMillis());
	  wdContext.currentContextElement().setFrom(date);
    //@@end
  }

This will start the date at 01/01/2008 and user should be able to select any date.

Hope this helps.

Vishwas.

Former Member
0 Kudos

HI Vishwas Madhuvarshi,

Thank You Very much .......I got final result with your code.......

Thank you ....

Ramprasad

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank you all ....for Sharing ideas to solve my problem .....

Thank you And REGARDS

Former Member
0 Kudos

You could use following ways to achieve this:

create a simple type; define your date format and use it.

change the locale of the user; to Australian/UK and it will change accordingly.

regards

Jawed Ali

Former Member
0 Kudos

Hi,

In Dictioanry Create a simple data type of Type Date ,and in the representation part of Simpe data type give the Format which you want eg:-dd-MM-yyyy

Then come to the context and give the type of it as the variable in the context as the variable which you created in the dictioanry.

Then your problem will be solved

Regards,

Padma N

Former Member
0 Kudos

Hi....can u try with function modules

HR_IN_GET_DATE_COMPONENTS

It gives you day , month, year in seperate variable...

U can process it as per requirements

I hope ..it is useful

Thanks

Former Member
0 Kudos

I am not using any RFC. I am just trying out a sample to set the date..... to input field of attribute of type date ....

i'm getting's default system date ... can i set default default date as i wish ..........

Regards....

Ramprasad......

vmadhuvarshi_
Contributor
0 Kudos

Ramprasad,

Use this code to default the date to January 1st, 2001. From is the context attribute bound to your InputField.


 public void wdDoInit()
  {
    //@@begin wdDoInit()
	  Calendar calendar = new GregorianCalendar(2001, 0, 1);
	  Date date = new Date(calendar.getTimeInMillis());
	  wdContext.currentContextElement().setFrom(date);
    //@@end
  }

Hope it helps.

Vishwas.