# Set Scheduled Task start time via variable

**URL:** https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996
**Category:** Discussion
**Created:** [October 3, 2008, 6:36am UTC](https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996 "2008-10-03T06:36:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![markm](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@markm](https://www.finalbuilder.com/forums/u/markm)
#### Post date: [October 3, 2008, 6:36am UTC](https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996/1 "2008-10-03T06:36:39Z")

</div>

Hi;

Is there any way to set the Absolute start time of a Add Scheduled Task action to a variable?

The UI allows me to enter %StartTimeVariable% in the Absolute start time drop-down but this value does not appear to be retained on OK/Save.

I'd appreciate any pointers - thanks.

Mark

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [October 7, 2008, 1:26am UTC](https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996/2 "2008-10-07T01:26:33Z")

</div>

Hi Mark,   
  
 You will need to use the “BeforeAction” script event of the “Schedule Add” action and use the following script:

```
var absDate = new Date([YOUR_VARIABLE]);

Action.PropertyStore.absDay = absDate.getDate();
Action.PropertyStore.absHour = absDate.getHours();
Action.PropertyStore.absMin = absDate.getMinutes();
```
   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

### Author: ![markm](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@markm](https://www.finalbuilder.com/forums/u/markm)
#### Post date: [October 14, 2008, 11:59am UTC](https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996/3 "2008-10-14T11:59:12Z")

</div>

Paul;

Thanks for the reply - but I can't get it to fly. Here's the error:

Error Executing script : BeforeAction  
Microsoft JScript runtime error  
'PropertyStore' is null or not an object  
Line : 2  
Char : 3  
Error in BeforeScript : JavaScript, This Action did not execute.

Here's the code located on the BeforeAction in the Add Scheduled task:

&nbsp; var absDate = new Date([BackupStartTime]);  
&nbsp; Action.PropertyStore.absDay = absDate.getDate();  
&nbsp; Action.PropertyStore.absHour = absDate.getHours();  
&nbsp; Action.PropertyStore.absMin = absDate.getMinutes();

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 15, 2008, 12:14pm UTC](https://www.finalbuilder.com/forums/t/set-scheduled-task-start-time-via-variable/996/4 "2008-10-15T12:14:37Z")

</div>

Hi Mark

I think Paul must have been looking at the wrong action, here's an example that worked for me :

Action.AbsoluteStartTime = StrToDateTime("10:32")

The value passed to StrToDateTime can be any valid time format (e.g 14:32 or 10:45PM )

HTH

&nbsp;
