SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    Connecticut
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASPx code for date?

    Hi,

    I don't know ASPx at all, but I working with some simple code here that is supposed to display the date automatically at the bottom of a page. Here is the code:

    <%=response.write(" " & year(now) & " Company Name")%>


    But nothing shows up at all.

    Same deal when taking out the equals sign.

    Any help?

    Thanks, Chris

  2. #2
    SitePoint Evangelist Muller2's Avatar
    Join Date
    Feb 2005
    Location
    Oxford, UK
    Posts
    522
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From your example you only seem to be interested in the year.

    This is the VB code
    Code:
    litDay.Text = dtNow.Year
    This is the C# code (NOTE: this displays Month, Year)
    Code:
    private void Page_Load(object sender, System.EventArgs e)
    {
       DateTime dtmDate = new DateTime();
       dtmDate = DateTime.Now;
    
       // Month and Year
       Response.Write( dtmDate.ToString( "Y" ) + "<BR>" );
       // => Displays February, 2001
    }
    Hope that helps.

    Al


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •