Click here to Skip to main content
12,070,030 members (29,030 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi all,
I want to remove time from a date in datagridview(winform application). when i search in net they all have given about asp.net gridview . but i want to know how to change that in winform application.

thanks
parithi
Posted 1-Feb-12 19:54pm
Comments
manognya kota 2-Feb-12 0:55am
   
What are you using for displaying date? a datetimepicker? or anything else?Please clarify
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

To Format as dd/MM/yyyy is     this.dgView.Columns["Inv/Ch Date"].DefaultCellStyle.Format = "dd/MM/yyyy";
To Format as dd/MMM/yyyy is     this.dgView.Columns["Inv/Ch Date"].DefaultCellStyle.Format = "dd/MMM/yyyy";
To Format as dd-MMM-yyyy is     this.dgView.Columns["Inv/Ch Date"].DefaultCellStyle.Format = "dd-MMM-yyyy";
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi friend,

try this querry :This may help you


select convert(varchar(20),Date_ColumnName,101) as [Date] from Database_Name


Or Use this in Data Grid View
dataGridView1.Columns[0].DefaultCellStyle.Format = "dd/MM/yyyy";
  Permalink  
v3
Comments
Rajesh Anuhya 2-Feb-12 1:16am
   
Code tags added
--RA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

See the below links to get different date formats in sql server

http://www.sql-server-helper.com/tips/date-formats.aspx[^]
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx[^]

Thanks
--RA
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

you can use with C#

var dateAndTime = DateTime.Now;
var date = dateAndTime.Date;

The date variable will contain the date.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160208.1 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100