Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Display date on Aspx page?

I am using asp.net webforms for the first time and am trying to display the current date in the following form: Friday, July 13

<h3>Suggested reading for <% DateTime.Now.ToString(); %></h3>

However, this only displays

Suggested reading for

on my page.

I don't know if this helps, but here is some surrounding code:

<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="Fake_Coupon_Site.Account.Register" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <hgroup class="title">
        <h1><%: Title %>.</h1>
        <h2>Use the form below to create a new account.</h2>
        <h3>Suggested reading for <% DateTime.Now.ToString(); %></h3>
    </hgroup>
like image 665
ArmorCode Avatar asked Feb 13 '23 20:02

ArmorCode


1 Answers

Try

<h3>Suggested reading for <%= DateTime.Now.ToString("dddd, MMMM dd") %></h3>
like image 101
Brent Mannering Avatar answered Feb 22 '23 20:02

Brent Mannering