Solved

Data Formatting Expression

Posted on 2004-09-10
8
2,116 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
[X]
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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 17

Expert Comment

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

Author Comment

by:uncommonX
ID: 12027087
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
ID: 12027132
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:daffodils
ID: 12028777
0
 
LVL 35

Expert Comment

by:YZlat
ID: 12029119
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
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
0
 

Author Comment

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

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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