Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Date field to day extensive
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Date field to day extensive

 Post Reply Post Reply
Author
drico View Drop Down
New Member
New Member


Joined: 09 Jun 2016
Points: 4
Post Options Post Options   Quote drico Quote  Post ReplyReply Direct Link To This Post Topic: Date field to day extensive
    Posted: 09 Jun 2016 at 11:52am
HI folks,

i a newbie and i need some help

i have a 2 fields

1 - date (input by user)
2 - day of week (example monday)

it's possible show the value day automatically?

i attach the problem
https://drive.google.com/file/d/0BwXcPCv0ATWfV3BBNnlzWmtIeFk/view?usp=sharing

thanks for any help


Back to Top
Sponsored Links


Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 615
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 09 Jun 2016 at 11:56am
Yes, it's possible. Use this code as the custom calculation script of the DAY field:

var days = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"];
var date = this.getField("DATE").valueAsString;
if (date=="") event.value = "";
else event.value = days[util.scand("dd/mm/yyyy", date).getDay()];
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
drico View Drop Down
New Member
New Member


Joined: 09 Jun 2016
Points: 4
Post Options Post Options   Quote drico Quote  Post ReplyReply Direct Link To This Post Posted: 09 Jun 2016 at 2:23pm

awesome @try67

thank you very much

greetings
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4071
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 11 Jun 2016 at 4:51pm
Yes. this is covered in the Acrobat JavaScript API Reference in the util.scand andutil.printd methods.


// custom calculation for the day of week field;
event.value = "";
var cMyDate = this.getField("MyDate").valueAsString;
if(cMyDate != "")
{
var oDate = util.scand("mm/dd/yyyy", cMyDate);
event.value = util.printd("dddd", oDate);
}



Edited by gkaiseril - 11 Jun 2016 at 4:57pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.033 seconds.