These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Change format of date

Lea1337
Registered: Jul 14 2009
Posts: 64

I have a datefield in my form, and upon submitting the form I get the value of that datefield and put it into the subject field of the e-mail, something like this:

var myDate = Main_subform.subform1.startDate.rawValue;

var mail = "mailto: test [at] test [dot] com?subject=This is the subject on " + myDate;

And the date presented in the subject field is YYYY-MM-DD, which I guess is the standard. I wish to present the date as DD.MM.YYYY, how can I achieve this? I've tried a few things, but it doesn't turn out right, probably because I'm not using the right syntax or using the functions in the wrong way..

My Product Information:
LiveCycle Designer, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
try this:
util.printd("dd.mm.yyyy", myDate)

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Lea1337
Registered: Jul 14 2009
Posts: 64
I tried that one earlier, but unfortunately it gave a result like this:

"This is the subject on -6528.2539.-27732"
try67
Expert
Registered: Oct 30 2008
Posts: 2398
I guess LC doesn't support this function the same way that Acrobat does.
Maybe someone else can help you out...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Lea1337
Registered: Jul 14 2009
Posts: 64
I have used it in LC before, although then I used it along with the new Date() function, like this:

util.printd("dd.mm.yyyy", new Date())

which works just fine. Maybe the problem lies when I fetch the date with 'rawValue', maybe I should do this some other way, problem is I don't know how :-)
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Have a look at util.scand()

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Lea1337
Registered: Jul 14 2009
Posts: 64
Just tried it, but no better luck, this time the result was:

"This is the subject on null"
try67
Expert
Registered: Oct 30 2008
Posts: 2398
No, I mean you can use scand to convert the rawValue to a Date object, which in turn you can print out using printd.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Lea1337
Registered: Jul 14 2009
Posts: 64
Tried that too, but given that util.scand returns a null value, it doesn't really like it when I try printing it out with util.printd (which, as far as I understand, basically is supposed to turn a date into a string). So I get an error instead :-p