function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CaptaConsultingCaptaConsulting 

How to change the value of a field with type date?

Hi, I have a problem, i need to do something like that in a field with type date:

 

sobj2.item('StartDate').value = sobj.item('EndDate').value + 1;

 

but this give me an error.

Anyone can help me?

 

Thanks.

Víctor �lvarez

 

 

 

DevAngelDevAngel

Hi CaptaConsulting,

I would recommend a date function.  I think you have DateAdd and what not.  Check the VBA documentation for details.

CaptaConsultingCaptaConsulting

Hi , i have tried this in javascript :

var miFecha = new Date(sobj.item('EndDate').value);
miFecha.setDate(miFecha.getDate() + 1);
    

sobj2.item('StartDate').value = miFecha.getDate() +"/"+ (miFecha.getMonth()+1) +"/"+ miFecha.getYear();

and it works.

But i have a doubt....

i don´t know why when i go to salesforce to check the result .

The start date field has the value , for example 22/03/2004 and if a write the line in the sforce control

miFecha.getDate() +"\"+ (miFecha.getMonth()+1) +"/"+ miFecha.getYear();

in the window appear 23/03/2004 (the day before). So i need to increment two days the date value.

miFecha.setDate(miFecha.getDate() + 2);

 

Can anyone help me ? . Thanks.

 

Víctor �lvarez

Capta Consulting

 

 

 

 

 

DevAngelDevAngel

Hi Victor,

I think what your are seeing is a problem with time zones. 

CaptaConsultingCaptaConsulting

Hi Dave,

 

it´s true, it´s a problem with time zones.

 

Thanks.

Víctor �lvarez

Capta Consulting.