Use a Javascript,
Cuz this runs in the client browser.
Check out this code..
var Days = new Array('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
var today = new Date();
var Year = takeYear(today);
var Month = leadingZero(today.getMonth()+1);
var DayName = Days[today.getDay()];
var Day = leadingZero(today.getDate());
var Hours = leadingZero(today.getHours());
var Minutes = leadingZero(today.getMinutes());
var Seconds = leadingZero(today.getSeconds());
function takeYear(theDate)
{
x = theDate.getYear();
var y = x % 100;
y += (y < 38) ? 2000 : 1900;
return y;
}
function leadingZero(nr)
{
if (nr < 10) nr = "0" + nr;
return nr;
}
I got it from this
URL
Your code is working on the server side ,so thats the reason Y you are getting date on the server.
For you code to work on the client side,You gotta code that in Javascript that runs in the client browser.