473,399 Members | 4,177 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,399 software developers and data experts.

Want to hide the time from the date field in GridView in ASP.Net with SQL

I m using ASP.NET 2005 with VB,C#.
I m using GridView to display the data.

My problem is with the database field date.
I want to use only the date and the fields are manufacturing date and expiry date of some items.
But,in the gridview it displays the time which is by default same for all the entries which 12:00A.M.

I have used date picker for designing.

What should be the validation for showing only the date and not the time ??
How to hide the time from the gridview.
I m using SQL Server 2005 to store database where i have selected the datatype as date/time.
Mar 31 '07 #1
4 5231
kenobewan
4,871 Expert 4TB
If you are using Visual Studio, then you can apply formatting in the properties of the column. HTH.
Mar 31 '07 #2
hi,

Use the following format values to assign only time in the datagridview

DateTime.Now.ToLongTimeString();

I m using ASP.NET 2005 with VB,C#.
I m using GridView to display the data.

My problem is with the database field date.
I want to use only the date and the fields are manufacturing date and expiry date of some items.
But,in the gridview it displays the time which is by default same for all the entries which 12:00A.M.

I have used date picker for designing.

What should be the validation for showing only the date and not the time ??
How to hide the time from the gridview.
I m using SQL Server 2005 to store database where i have selected the datatype as date/time.
Apr 2 '07 #3
hi,

Use the following format values to assign only time in the datagridview

DateTime.Now.ToLongTimeString();

Sorry,i don't got it...how can i format ??

And i want to show only the date not time which i coming in my gridview.Which property should be set for that ??
Apr 4 '07 #4
bhangu
1
Sorry,i don't got it...how can i format ??

And i want to show only the date not time which i coming in my gridview.Which property should be set for that ??
just set DataField="DateCreated" SortExpression="DateCreated" ApplyFormatInEditMode="True" DataFormatString="{0:dd/MM/yy}" HtmlEncode="False" />

in your boundfield and it will work fine
Apr 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: MasterChief | last post by:
I have a gridview that is bound to a date/time field in sql. How can I remove the time part of it so it doesn't show up at all in the gridview?
1
by: tony | last post by:
Hello!! I have an application that consist of several windows forms. Lets call these A,B and C for simplicity. I have one main meny where the user can choose window form A or B or C. When a...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
3
by: =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?= | last post by:
Hi, I have a GridView with a fixed number of columns being returned from a SQL query and each having a simple template: <asp:TemplateField HeaderText="Allocations"> <edititemtemplate>...
3
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second...
1
by: Anne | last post by:
Hi, I have a gridview that display questions & answers. In some case the answers are text (up to 5000 char) and other cases they are tick boxes or numbers ($), or date. I have created 2...
0
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
4
by: =?Utf-8?B?ZGNoMw==?= | last post by:
Is there a way to conditionally format a dateTime field to produce on result if the value is 10/31/2008 12:00 AM (user didn't enter a time) and another result if the value is 10/31/2008 5:30 PM...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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
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.