# Using variables with new Date() object

**URL:** <https://forum.kirupa.com/t/using-variables-with-new-date-object/274648>\
**Category:** Uncategorized\
**Created:** [November 2, 2008, 1:42am UTC](https://forum.kirupa.com/t/using-variables-with-new-date-object/274648 "2008-11-02T01:42:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdawg](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@kdawg](https://forum.kirupa.com/u/kdawg)\
**Post date:** [November 2, 2008, 1:42am UTC](https://forum.kirupa.com/t/using-variables-with-new-date-object/274648/1 "2008-11-02T01:42:07Z")

</div>

I have a related problem when trying to pass a variable from SWFObject to a new Date() object.

From SWFObject:

```auto
flashvars.startDate = "2010,0,10";

```

From SWF:  
[AS]eventDate = new Date(startDate);[/AS]

Obviously this didn’t work so I thought I need to unescape the startDate variable?

From SWFObject:

```auto
flashvars.startDate = "2010%2C0%2C10";

```

From SWF:  
[AS]eventDate = new Date(unescape(startDate));[/AS]

No go. What am I doing wrong?

This works but I’m trying to be efficient.  
From SWFObject:

```auto
flashvars.startYear = "2010";
flashvars.startMonth = "0";
flashvars.startDay = "10";

```

From SWF:  
[AS]eventDate = new Date(startYear, startMonth, startDay);[/AS]
