日時を変換して、次の形式を指定したい
Wed Aug 01 2012 14:37:50 GMT+0530 (India Standard Time)
実際、WebページでJqueryを使用してタイマーを表示したいと思います。だから私は私が知っているいくつかのフォーマットを試しました。そして、http://www.dotnetperls.com/datetime-formatからいくつかを見つけましたが、どれも私が必要とする結果を返しません。実際、私はサーバーから時間を渡さなければならないので、次のコードを試しました。 コードビハインド
protected void Button3_Click(object sender, EventArgs e)
{
    //string hello = DateTime.UtcNow.ToString();
    string hello = String.Format("{0:F}", DateTime.UtcNow);
    DateTime.UtcNow.ToString("");
    ScriptManager.RegisterStartupScript(this, this.GetType(), "hdrEmpty1", "show(" + hello + ")", true);
}
Jquery
function show(datetime) {
        alert(datetime);
        var Digital = datetime  //new Date()
        var hours = Digital.getHours()
        var minutes = Digital.getMinutes()
        var seconds = Digital.getSeconds()
        var dn = "AM"
        if (hours > 12) {
            dn = "PM"
            hours = hours - 12
        }
        if (hours == 0)
            hours = 12
        if (minutes <= 9)
            minutes = "0" + minutes
        if (seconds <= 9)
            seconds = "0" + seconds
        document.getElementById('<%= Label1.ClientID %>').innerHTML = hours + ":" + minutes + ":" + seconds + " " + dn
        setTimeout("show()", 1000)
    }