getting JUST date from datetime not displaying correctly

here is my select command:

SelectCommand="SELECT [JobID], [EmployeeName], 


 ) AS Date, 

[From], [To], [Company], [Catagory], [Client], [Description], [TotalHours] FROM [JcpowersJobs]" 

It will show correctly in the query builder test but when you load it up in the gridview it will show the date AND 12:00:00AM for every one of the dates

I tried replacing DATETIME with VARCHAR but it would insert spaces into the date where I didn't want them: EX: (12/04/1994 => 12/ 04/ 1994)

any suggestions?
6/2/2008 3:49:11 PM 29906 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 7

You can modify the GridView column like this:

     <asp:BoundField DataField="MyDate" DataFormatString="{0:dd/MM/yyyy}" 
            HeaderText="MyDate" SortExpression="MyDate" />
Steve Wellens

My blog
6/2/2008 3:54:49 PM

Similar Artilces:

Getting just the date from a "datetime" sql column along with other data of different formats
Hi. I have a web page that gets the current user, then goes into a database and gets a list of invoices, this includes: invoice numbers, the date of the invoice, the date the invoice was paid, and the amount of the invoice. The data is then bound to a repeater control and displayed. i need a way to get just the date and not the date and time from the datetime columns. Here is my code that i have now: This next part gets the current user, then creates the selection string and binds the repeater to the data.Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) ...

getting just the date or from DateTime field
Hi, I have used smalldatetime datatype to store my date and time values. i want to store just the date or time but the problem is it stores both the date and time. For eg, if i add the the date 03/11/2004, it also the stores the current time automatically. so the new value will be something like 03/11/2004 10:00:00 AM where i want just 03/11/2004. further problem is even though i managed to store just the date like 03/11/2004 in the database, whole date and time shows up when i display it in my pages. any help will be appreciated. thanx,-keeara g------------------ If i want to dis...

get DateTime.Now.Date in sql
 Hi, Im making an c# website. I use an dataset and an gridview.  I will fill an gridview with users with the follow sql query:SELECT     UserIdFROM         StatsWHERE     LunchDate =  DateTime.Now.Date()How can I get all the users with the date of today?I have try the follow solution but it doesnt work:SELECT     UserId FROM         Stats WHERE     LunchDate =  @LunchDateIn the objectDataSource I hav...

sql date in correct format but displaying incorrectly
I am adding a date into a sql table using GETDATE()It correctly adds the date to the table as  DD/MM/YYYY But when I display the contents of the table on a page using a DetailsView:<asp:Label ID="Label8" runat="server" Text='<%# Bind("DateRegistered","{0:d}") %>'></asp:Label> the date is displayed as MM/DD/YYYYHow do I get it back to dd/mm/yyyy. I thought the way its stored is the way it comes out?  Text='<%# Convert.ToDateTime(Eval("DateRegistered").ToString()).ToString("dd/MM/yyy")...

SQL DateTime and Searching for just the date portion
I have a SQL DB with a column called time_occurred that is formatted like ( 7/28/2004 7:10:30 AM ). What I need to do is run a report based on just the month day and year portion. I am using the calendar control so mins, sec and milliseconds are not available nor do I really need them. I am running the Query with this Stored Procedure ALTER PROCEDURE dbo.Prodecure1 ( @WhereClause varchar(8000) ) AS -- Create a variable @SQLStatement DECLARE @SQLStatement varchar(8000) -- Enter the dynamic SQL statement into the variable @SQLStatemen...

DateTime Datatype, How to display just Date, not time
I have a column with DateTime Datatype. But I want to display just Date , not time. Like 4/26/2006  not 4/26/2006 9:25:55AM pls help check out the CONVERT and CAST functions. Try the following. If you check out books on line for the CONVERT functions they have a list of values and the formats the function will produce with the value. Here's an example:   SELECT CONVERT(varchar, getdate(), 101) ***********************Dinakar NethiLife is short. Enjoy it.*********************** Format it before output. Cdate("10/1/2006 11:00:00").Tostring("d") or if you are using it, and da...

get only date from a date with a datetime format
i have a problem with dates when it comes to searchingbasically, SQL searches for a date including the seconds,but i only need to date so that in any given time, it will yield a's a part of my code-behind code: reqNo = RequisitionsLogic.GetReqNoByDate(currentDate, requestorCode)and here's the SQL statement created in a TableAdapter:SELECT RequisitionNoFROM RequisitionsWHERE (RequisitionDate = @RequisitionDate) AND (RequestorCode = @RequestorCode) take a look with this, don't just accept influenceshttp://thedailyarr.tk

How can I get the to display in english date format
I have to get the System.DateTime.Now to display the date in the format : Day/Month/Year as opposed to the american Month/Day/Year. Anyone know how to do this. Heres my code: private void C1WebGrid1_ItemDataBound(object sender, C1.Web.C1WebGrid.C1ItemEventArgs e) { C1ListItemType lit = e.Item.ItemType; String jobDueByDate; DateTime TodaysDate = System.DateTime.Now; if (lit == C1ListItemType.Item || lit == C1ListItemType.AlternatingItem) { DataRowView drv = (DataRowView) e.Item.DataItem; jobDueByDate = drv[JobData.DUE_DATE_FIELD]...

Free .Net and Sql Server Training Videos for Developers just getting started
I figured since this is the Getting started forum I would mention a great .Net training video site with some free videos.http://www.TechnicalVideos.netThanksMike James...

Get date portion from DateTime (with DateTime property)
    private string _Date;    public string Date    {        get { return _Date; }        set { _Date = value; }    } objDados.Date = Convert.ToDateTime(drResult["APP_DATE"]).Date.ToString("dd/MM/yyyy"); If I replace _Date from string to DateTime, how can I get only date portion from DateTime? ThanksBest regards,Ivan Andrade Hi  you could always copy it. But I'd put the Date property to be of DateTime type. Something like:  &...

.NET DateTime and SQL Server DateTime problem
.NET DateTime and SQL Server DateTime problem  I have the following if statement in an SQL stored procedure: IF (@Image = 1 AND @DateTimeUploaded = (SELECT ImageMainDateTime FROM Images WHERE UserID = @UserID))   The value of the @DateTimeUpdated variable was taken from the ImageMainDateTime field when the data was requested by a ASP.NET webpage and is passed back here when that page is submitted so I can compare what the DateTime was when the data was requested with what it is now, in other words I’m doing a concurrency check (I can’t use TimeStamp for many reasons, ...

Convert .NET DateTime format to SQL DateTime format
Hi!!I'd like to know if there is a function to convert the DateTime format used in C# (VS2005) : dd/mm/yyyy HH:mm:ss to the format used in SQL Databases: yyyymmdd HH:mm:ssThanks folks!...

Get Date and compare with Date.Now in T-SQL
I am trying to set an alert to user for a project which will due on the particular date. How to compare the DateTime due date  which I get from the database with the Date.Now in stored procedure? Thanks in advance.Best regards,Ron. Make sure they are both in the same format. Many different ways to accomplish. The example below would convert both to a date: select * from table where convert(nvarchar(15),DueDate,101) = convert(nvarchar(15),Date.Now(),101) Thanks samsta, but I got an error when I am using Date.Now(). Then, I change with GetDate() function and works just ...

How to get the current date in C# and how do I pass this date to SQL Server
I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005. So I have a question 1.) How do I get today's date in C# and how should this be passed to SQL server? you can get the current date directly in SQL using getdate()KH Doing it in C# will return you the client system date. Getting the current date in SQL will ensure all datetime recorded in your application are in sync. If you are using the date for some sort of comparison determine the sequence of ...

Web resources about - getting JUST date from datetime not displaying correctly -

List of mammals displaying homosexual behavior - Wikipedia, the free encyclopedia
For these mammals, there is documented evidence of homosexual behavior of one or more of the following kinds: sexual behavior , courtship , affection ...

Facebook Displaying Page Insights On Page Admins’ Personal Pages?
Some Facebook page administrators are seeing modules on their personal pages displaying page insights ad, campaign , and like totals for pages ...

Facebook Displaying Unread Messages from Pages in a New Updates Module
Facebook is displaying a new “Updates” sidebar module which shows some users unread messages sent to them by Pages. Users will see the Updates ...

Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air CNN Live - YouTube
Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air Lemon held up a Confederate flag first before holding up the sign. He asked, ...

Hazelwood coal mine fire: Morwell residents displaying symptoms similar to cigarette smokers, expert ...
An expert says some locals near Victoria's Hazelwood mine fire have symptoms similar to cigarette smokers.

Police accused of displaying fake G20 weapons
Toronto's top police officer misled the public by displaying fake weapons used in a medieval-themed role-playing game to help justify their actions ...

No charges for U.S. host for displaying high-capacity magazine on TV
NBC television journalist David Gregory won't face charges for displaying a high-capacity ammunition magazine on his "Meet the Press" news program ...

Jays' Escobar suspended three games for displaying slur
Toronto Blue Jays shortstop Yunel Escobar has been suspended three games for displaying a homophobic slur on his eye-black during a game on Saturday. ...

Google Play Store now displaying age-based ratings
We reported back in May that Google was adding age-based ratings to all apps in the Play Store as determined by the International Age Rating ...

Apple displaying Ferraris & other cars at WWDC hinting at CarPlay announcements
... 2014 Filed under: AAPL Company , iOS Continue reading more about AAPL Company and iOS at 9to5Mac . What do you think? Discuss "Apple displaying ...

Resources last updated: 11/21/2015 2:42:01 AM