473,406 Members | 2,281 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,406 software developers and data experts.

DateTime value as just Time on DataGrid

How do I setup the DataGridTextBoxColumn object so that a
DateTime variable only shows the time portion?
Nov 20 '05 #1
3 1511
Set your formatting string to be {0:t} I believe... hang on lemme check
that...

<pause while I look>

Yes.. thats right

So, your textbox .text field would be
String.Format("{0:t}",
myDateTimeFieldMemberValueInfoMemberValueDotcomDot Org)

Look up DataTimeFormatInfo class (seriously) and it will show you all the
formatting patterns

-CJ

"Sean" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
How do I setup the DataGridTextBoxColumn object so that a
DateTime variable only shows the time portion?

Nov 20 '05 #2
How do I apply that to a DataGridTextBoxColumn?

Dim dgtbc_StartTime as New DataGridTextBoxColumn

dgtbc_StartTime.Format = "{0:t}"

doesn't work right. I was using:

Dim ltpPattern As New
System.Globalization.DateTimeFormatInfo

dgtbc_StartTime.Format = ltpPattern.LongTimePattern

but that strips the AM/PM off of my time.

Thanks

-----Original Message-----
Set your formatting string to be {0:t} I believe... hang on lemme checkthat...

<pause while I look>

Yes.. thats right

So, your textbox .text field would be
String.Format("{0:t}",
myDateTimeFieldMemberValueInfoMemberValueDotcomDo tOrg)

Look up DataTimeFormatInfo class (seriously) and it will show you all theformatting patterns

-CJ

"Sean" <an*******@discussions.microsoft.com> wrote in messagenews:04****************************@phx.gbl...
How do I setup the DataGridTextBoxColumn object so that a DateTime variable only shows the time portion?

.

Nov 20 '05 #3
Hmmm... not sure why the second is stripping the AM /PM off it, have you
tried a different format and see what happens? Wish I could give better
advice than that unless you could override on the bidning (like asp.net) and
set it there, but don't knowi f you can.

-CJ
"Sean" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
How do I apply that to a DataGridTextBoxColumn?

Dim dgtbc_StartTime as New DataGridTextBoxColumn

dgtbc_StartTime.Format = "{0:t}"

doesn't work right. I was using:

Dim ltpPattern As New
System.Globalization.DateTimeFormatInfo

dgtbc_StartTime.Format = ltpPattern.LongTimePattern

but that strips the AM/PM off of my time.

Thanks

-----Original Message-----
Set your formatting string to be {0:t} I believe... hang

on lemme check
that...

<pause while I look>

Yes.. thats right

So, your textbox .text field would be
String.Format("{0:t}",
myDateTimeFieldMemberValueInfoMemberValueDotcomDo tOrg)

Look up DataTimeFormatInfo class (seriously) and it will

show you all the
formatting patterns

-CJ

"Sean" <an*******@discussions.microsoft.com> wrote in

message
news:04****************************@phx.gbl...
How do I setup the DataGridTextBoxColumn object so that a DateTime variable only shows the time portion?

.

Nov 20 '05 #4

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

Similar topics

2
by: A Programmer | last post by:
I can't believe I have never run into this before but, I have an object that has a property of type DateTime. A collection of these objects are used to populate my DataGrid. In DateTime format they...
2
by: Marco Martin | last post by:
Hi all, I've got a DataTable that has a datetime column that is bound to a datagrid. The Datetime Column holds both Date *and* time, but my Datagrid only shows the date. How would I go about...
15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
3
by: Jim H | last post by:
I have a DataGrid where the DataSource is a DataTable that has a DateTime column. Right now it only shows the Date, I want the date and time down to the seconds or better. How do I set the...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
1
by: Adil Bohoudi | last post by:
Hi all, i'm using a datagrid to show somedata retrieved from an sql-server 2000. this datagrid contains two columns a startdate and an enddate column. i used a storedprocedure to get both...
3
by: Paul Say | last post by:
I have a class called Job, that has several properties JobID,Description & StartDate. The StartDate is Property is defined as follows public Class Job private _StartDate as DateTime public...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
6
by: jr1024 | last post by:
Hi everybody! I have a C# app that connects to a mdb file and displays all the fields from a table in dataGridView. I have trouble searching in a Access Date/Time field like this. string...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.