How can I add a comma or @ to a DataFormatString

Posted on 2009-02-13
Last Modified: 2012-08-14
I have the following dataformatstring in a gridview to format a date.  It works quite well, but I'd like to put a comma or @ between the date and time just to be fancy and make the department who's getting this app a little more enthused when they see it.

The string is:

0:M/dd/yyyy h:mm tt
Question by:mrcoulson
    LVL 16

    Expert Comment

    dt.ToString("0:M/dd/yyyy @ h:mm tt")
    LVL 16

    Accepted Solution

    or for the comma
    DateTime dt = DateTime.Now;
    dt.ToString("M/dd/yyyy , h:mm tt");
    previos answer should be
    dt.ToString("M/dd/yyyy @ h:mm tt")

    Author Comment

    Wow.  Had no idea it would be so simple.  Lord.  Thanks!

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now