It has compile error:
CS1026: ) expected
Main Topics
Browse All TopicsHi
I write asp.net, c# and javascript
In the js, I need to get the system datetime and in the format yyyy-MM-dd
However, it has runtime error.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can always do that in Pure Javascript, you can try download this Date Parse Library:
http://www.javascripttoolb
and then try something like this:
> CS1026: ) expected
the ";" is still there, wrong copy / paste, apologies. If you paste the following, and move with your mouse over the "move mouse" text, you will see the current date (name of the page Q_24312175.aspx, remove the first line(s) if you want to use it in your page, or add a form by that name).
I was going to suggest just get the data from Javascript like Ryan did. I didnt know there was a library involved though. Ryan, is that just for formatting?
Only methods I know is getyear(), getMonth() getDay(). Now these dont return leading zeros, so if u want that, you need to add it
eg
var currentDate = new Date();
var dStr = currentDate.getYear() + "/" + leadingZero(currentDate.ge
leadingZero(currentDate.ge
alert(dStr);
and the leading zero function
function leadingZero(n)
{
if (n < 10) n = "0" + n;
return n;
}
> Thanks for all help.
you're welcome, glad we could have been of some help.
However, as a long-time regular to EE I have to point you to the fact that it is best to just split the points and not except your own comment (which is not an answer) as answer. That way, people visiting this question get the correct answer and the PAQ archive of EE stays proper.
-- Abel --
Business Accounts
Answer for Membership
by: abelPosted on 2009-04-10 at 05:38:46ID: 24115077
Try:
ng("yyyy-M M-dd"); %>';
'<%= System.DateTime.Now.ToStri
I don't know why you put in the backslashes there, but you are not inside a string, so they are not necessary.