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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.


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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

778 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