开发者

how can I assign a date in format string to a javascript date variable?

I'm registering a javascript in aspx.net

Dim script = "<script language = javascript>" & _
                           "开发者_C百科window.setTimeout('ShowTime(true, [?????])', 1000);</script>"

ClientScript.RegisterStartupScript(Me.GetType, "iniciar", script)

I must write a dateTime parameter in string format, but I'm not achieving the goal. I've tryed various time formats (Eg. 2011/02/10 17:05:00), without success. Ps: I know... when I try with only the date, its ok. But I need the time too. Thanks.


Javascript lacks a comprehensive string-based format mechanism. Aside from manually piecing the date together using the Date object's methods like getMonth and getFullYear, one would have to create a script to do such formatting, or use one of the myriad existing functions on the internet. Here is an excellent example: http://blog.stevenlevithan.com/archives/date-time-format


Date.js is a great library for all date-related function in Javascript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜