Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get day value from date field

Community Beginner ,
Feb 18, 2020 Feb 18, 2020

Hello!
I would like to check whether the selected day is on a weekend, so like if it is saturday or sunday. So i am able to set the date format to "ddd" showing me "Sa" or "So" (German), yet when i try to grap the value from this field it gives me the selected date (like 23/02/2020 for "So").
Is there a way to grep the value "So" from the Field instead of the selected date?
Current Setup: First field selecting date by date, showing the date (23/02/2020). Second field shows the value from field 1 in the format "ddd" (So). Third field graps the getField("field2").value and gives back 23/02/2020, yet i want to check if the fieldvalue is So.

TOPICS
How to , PDF forms
2.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Feb 18, 2020 Feb 18, 2020
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2020 Feb 18, 2020
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 19, 2020 Feb 19, 2020
LATEST

thank you ls_rbls!
Actually i did find the solution in your links, i had to convert the picked date to a date object first. afterwards i could simply handle it as any javascript date object. Since your response was the first and even if the other guy is the actual writer of these tutorials i will mark your awnser as the correct one, thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2020 Feb 18, 2020

Yes, read the tutorial. 

The first thing you need to do is use the date text entry to create a date object. 

Then get the day of week with the "date.getDay()" method.

This is standard core JavaScript (not Acrobat JavaScript) so you can look up the Date object here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 19, 2020 Feb 19, 2020

Hello Thom,

after reading your tutorials i found out i first had to transform the picked dates to date objects. Since i didn't know i first have to convert the date to date objects i guess this is the reason why i didnt find it on google in the first place. your util.scand really helped me out there. After having converted it to a dateobject everything was working perfectly! Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines