Click here to Skip to main content
Rate this: bad
good
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 at 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 at 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
0 OriginalGriff 381
1 Praneet Nadkar 237
2 Marcin Kozub 225
3 Sergey Alexandrovich Kryukov 195
4 Shweta N Mishra 161
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,327
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,920


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2014
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