473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

formatting datetime data from a data reader field

Hi

In an ASP.NET application, I am doing the following (dtrData is a data
reader that has been loaded with data already):

if (dtrData.Read())
{
lblEDPresentationTime.Text = (DateTime)
dtrData["EDPresentationTime"].ToString();
}

Currently this is giving me values such as "24/07/2002 9:17:52 PM"
displayed.

What I want to do is get the date and the time bits and format them as I
wish.

I figure the best way to do this is to get the EDPresentationTime field
value into a system DateTime variable and then use formatting on that.

What is the way to get the field value into a DateTime type?

Thanks

Lauchlan M
Nov 15 '05 #1
1 6613
Use the IFormat provider to format your datatime as you wish

"Lauchlan M" <LM********@Hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi

In an ASP.NET application, I am doing the following (dtrData is a data
reader that has been loaded with data already):

if (dtrData.Read())
{
lblEDPresentationTime.Text = (DateTime)
dtrData["EDPresentationTime"].ToString();
}

Currently this is giving me values such as "24/07/2002 9:17:52 PM"
displayed.

What I want to do is get the date and the time bits and format them as I
wish.

I figure the best way to do this is to get the EDPresentationTime field
value into a system DateTime variable and then use formatting on that.

What is the way to get the field value into a DateTime type?

Thanks

Lauchlan M

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
0
by: Pavils Jurjans | last post by:
Hello, I have a third-paty application that uses text type field in MSSQL server to store data of incoming emails (full raw sources, including headers, etc.). Since the emails come in different...
3
by: Patrick Olurotimi Ige | last post by:
With the code below i get error:- Invalid attempt to read data when reader is closed. //Get a datareader SqlDataReader objDataReader; objDataReader =...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
8
by: ivijayan | last post by:
HI. I have the following query:- How do i create field which updates its contents on the basis of data in another field in same record. especially if I have a Date field, how can I change the...
10
by: thebuzzman | last post by:
I am creating a database for inputing ambulance run sheets. I have a table that lists different history conditions (HTN, CHF, Asthma....) In my main report form, I have a combo box that gets its'...
2
by: daknightuk | last post by:
I have created a database and I want to add a field to it which will store the password using the php encryption method of MD5 or SHA1 I just simply need to know what datatype to use in the...
1
by: Will | last post by:
Hi, This is might be a basic question, but is it possible to hold multiple pieces of data in one field? I am adpating a database which compares multiple projects against a number of criteria....
13
by: Desitech | last post by:
I want to create a command button on a form that will populate a certain field in a certain table for that record with a hyperlink address (just the text) and add another field from that record to...
4
by: sirvi | last post by:
what validation rule can be used to show :we cannot enter a data in a field, when another field does not have data.for example we can not enter details of a person untill we dont enter his name.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.