Solved

Data Formatting Expression

Posted on 2004-09-10
8
2,112 Views
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}

example:
Input:
September 10, 2004  9:25AM

Output:
10 Sep    0925
10 Sep    1425
0
Comment
Question by:uncommonX
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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")
0
 

Author Comment

by:uncommonX
Comment Utility
I know of those expressions but those are only a few of the actual expressions that I need
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
Comment Utility
0
 
LVL 8

Expert Comment

by:daffodils
Comment Utility
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 35

Expert Comment

by:YZlat
Comment Utility
the closest one is Fri, 10 Sep 2004 13:34:38 GMT

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

Expert Comment

by:YZlat
Comment Utility
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
0
 

Author Comment

by:uncommonX
Comment Utility
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
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
glad I could be of some assistance;)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

10 Experts available now in Live!

Get 1:1 Help Now