Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Data Formatting Expression

Posted on 2004-09-10
Last Modified: 2012-05-05
My project team is currently working on converting a web application from ASP to ASP.NET.  I am working on creating a data grid that shows a reports subject, start time, ID Number etc.  In a field that shows estimated start time I need a particular data format and in two time zones with a line return.  So far all I have is {0:dd MMM}

September 10, 2004  9:25AM

10 Sep    0925
10 Sep    1425
Question by:uncommonX
  • 3
  • 2
  • 2
  • +1
LVL 17

Expert Comment

ID: 12027016
Expression       Description
{0:C}             Formats the data as a default currency item (ie, $39.95)
{0:D3}             Formats the data as a zero-padded four-character wide number (ie, 0023)
{0:N2}%       Formats the data as a two decimal place number followed by a '%' symbol (ie, 59%)
{0:0.0}       Formats the data as a number, rounding to one decimal place (ie, 36.5)
{0:D}             Formats the data as a long date string (ie, "Thursday, December 25, 2003"; see the following figure)
{0:dd-MM-yy}       Formats the data as a dd-MM-yy date (ie, "20/05/04")

Author Comment

ID: 12027087
I know of those expressions but those are only a few of the actual expressions that I need
LVL 17

Accepted Solution

AerosSaga earned 250 total points
ID: 12027132
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Expert Comment

ID: 12028777
LVL 35

Expert Comment

ID: 12029119
the closest one is Fri, 10 Sep 2004 13:34:38 GMT

Response.Write(dt.ToString("R") + "<BR>")
LVL 35

Expert Comment

ID: 12029159
here is a function that will do that for you:

 Public Function FormatMyDate(ByVal dt As Date) As String
        Dim myDate As String
        myDate = dt.ToString("R")
        myDate = Trim(Right(myDate, myDate.Length - 4))
        myDate = Trim(Left(myDate, myDate.Length - 7))
        myDate = Replace(myDate, ":", "")
        FormatMyDate = myDate
    End Function

Author Comment

ID: 12029646
Thanks AerosSaga, the links you gave me got me the correct information:
{0:dd MMM HHmm}C <br> {0:dd MMM HHmm}Z

The time zone stuff will be a function utilizing the ToLocalTime function built into VB
LVL 17

Expert Comment

ID: 12029675
glad I could be of some assistance;)

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…

856 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