Current time option | Adobe Higher Education
Skip to main content
Level 2
April 28, 2022
解決済み

Current time option

  • April 28, 2022
  • 2 の返信
  • 1366 ビュー

Hello,

 

I wanted to ask if there is possibility to have a time field that has two options:

1. The time we enter manually

2. Current time

 

It would be similar to the Date field where we can choose any date or today's date.

 

Thanks for your help!

Magda

このトピックへの返信は締め切られました。
ベストアンサー Mayank_Gandhi

try this on initialize

 

var event = new Date();

field.rawValue=event.toLocaleTimeString('en-US');

2 の返信

MHWinter
Level 4
April 29, 2022

I am not sure if you can do it as you suggest but you van have a button next to your time field that set the value of the TimeField to the current time. Like this

If the TimeField format as HH:MM, the script in the click event of the button would be something like:

var d = new Date();
var ThisHour = d.getHours();
if (ThisHour<10) {ThisHour= "0"+ThisHour}
var ThisMinute = d.getMinutes();
if (ThisMinute <10) {ThisMinute = "0"+ThisMinute }
TimeField1.rawValue = ThisHour + ":" + ThisMinute;
Mayank_Gandhi
Adobe Employee
Adobe Employee
May 2, 2022

@magdabryla What kind of form is it? PDF or Adaptive?

magdabryla作成者
Level 2
May 3, 2022

@mayank_gandhi it's pdf.

 

Mayank_Gandhi
Adobe Employee
Adobe Employee
May 4, 2022

try this on initialize

 

var event = new Date();

field.rawValue=event.toLocaleTimeString('en-US');