cancel
Showing results for 
Search instead for 
Did you mean: 

How to get yesterday's date or previouse date

Former Member
0 Kudos

Hi all,

I am working on adobe forms and I want to get the yesterday's or previous date using java script. could please any one help me how to write java script?

Thanks in advance,

Phani Diwakar.

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

I had created a WIKI for similar issue. Adjust it as per your needs.

[FormCalc Scripting for Date Time Scenarios |http://wiki.sdn.sap.com/wiki/display/EmTech/FormCalcScriptingforDateTime+Scenarios]

Chintan

Answers (3)

Answers (3)

Former Member
0 Kudos

Solved myself.

Former Member
0 Kudos

Thanks for supporting me giving the answers. I solved myself.

For the reference,

var date12
date12 = Date() - 1

//DateTimeField1.rawValue = date12
DateTimeField1.rawValue = Num2Date(date12)

Here Date() function gives the current date in numbers. Deducting 1 from that number and converting the number to date using the function Num2Date() will get the yesterdays' or previous date.

chintan_virani
Active Contributor
0 Kudos

That is precisely what the WIKI talks about. Anyways good to see that you solved it.

Chintan

OttoGold
Active Contributor
0 Kudos

Hello,

you´d better compute this value in backend and pass it to the form and use only the value in the scripting. As far as I know, there are no such advanced functions in JavaScript. Or you can write the whole script yourself. But nobody is going to write it for you around here. Note that in the JS doc there is a last chapter full of ready-to-use examples.

If you don´t know where to start, start reading here:

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf

Regards, Otto