parsing date from variable

92 views
Skip to first unread message

Gids

unread,
Nov 16, 2009, 11:21:52 AM11/16/09
to Datejs - A JavaScript Date Library
Hi,

I am using date.js as part of a greasemonkey script and want it to
parse a date from the target page which I have set in a variable.
However, I can't seem to get this to work.

My current code looks like:

var d1 = Date.parse(myvariablename);
alert(d1.toString('dddd, MMMM d, yyyy'));

However, this doesn't seem to use the string from the variable. Sure I
am missing something pretty basic, but any guidance would be
appreciated.

Thanks,

Gids

geoffrey.mcgill

unread,
Nov 16, 2009, 5:58:01 PM11/16/09
to Datejs - A JavaScript Date Library
Hi Gids,

You code looks correct.

What is object type of "myvariablename"?

If a string, can you post a sample of the variable value?

Gids

unread,
Nov 17, 2009, 6:31:33 AM11/17/09
to Datejs - A JavaScript Date Library
Hmm, the variable is a string and it is working for me now, so I think
it was some other error in my code.
> > Gids- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages