how to get date via jquery ? [Resolved]

Posted by Akiii under jQuery on 6/7/2011 | Points: 10 | Views : 16771 | Status : [Member] | Replies : 7
Hi,
I have a footer in which i want to show the date via jquery. I have done it via javascript but how to use jquery in that.

<script type="text/javascript">
var d=new Date();
document.write(d);
</script>


Any help is appreciated...

Thanks and Regards
Akiii




Responses

Posted by: Nithadeepak on: 6/7/2011 [Member] Bronze | Points: 50
Posted by: Nithadeepak on: 6/7/2011 [Member] Bronze | Points: 50

Up
0
Down

Resolved
try using asp:label instead of span and give value through jquery
$('#label").html('<%=(System.DateTime.Now).ToString()%>');


Nitha Deepak

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/7/2011 [Member] Bronze | Points: 25

Up
0
Down
hi nitha......

i followed ur link but it is not showing me what i wanted. I am pasting my code here:-

<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>

<script type="text/javascript">
$(document).ready(function () {
$('#code').val('<%=(System.DateTime.Now).ToString()%>');
});
</script>


<div>Copyright 

<span id="code"></span>
, Akiii_Lethal. All Rights Reserved.
</div>


Please suggest me some measures....

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/7/2011 [Member] Bronze | Points: 25

Up
0
Down
hi....

i have changed it to asp:label and pasted the code but still it not showing anything....!!!

Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/7/2011 [Member] Bronze | Points: 25

Up
0
Down
hi nitha....

its working now....the resultant code is

<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>

<script type="text/javascript">
$(document).ready(function () {
$('#code').html('<%=(System.DateTime.Now.Year).ToString()%>');
});
</script>


<label id="code"></label>


Thank you for ur help...
I mark urs as an answer...
Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/7/2011 [Member] Bronze | Points: 25

Up
0
Down
Onething is that...its working on label not asp:label...

Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 6/7/2011 [Member] Bronze | Points: 25

Up
0
Down
Thanks akiii,


Nitha Deepak

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response