JavaScript picks the date from the client Machine DateTime value, This is how it works, If you want to use the server date, then store the current date in a hidden field and the use it across the JavaScript code.
<asp:HiddenField ID="hdnServerDate" runat="server" />
<script>
var serverDate = document.getElementById('<%= hdnServerDate.ClientID %>').value;
</script>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
hdnServerDate.Value = DateTime.Now.ToShortDateString();
}
}
Updated solution, based on
F-ES Sitecore comments
simplest way of doing
var serverDate = '<%= DateTime.Now.ToString("dd MMM yyyy") %>';