Date field showing date and time

Hey all,

I have a datagrid that gets a date but shows the time as well. How do I show only the date?
In the database only the date shows up.
Thanks in advance,
Rodney
0
rodchar
12/10/2003 6:11:15 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
750 Views

Similar Articles

[PageSpeed] 28

Hi Rodney,

This is a very good date and time formatting article.
http://datawebcontrols.com/faqs/CustomizingAppearance/FormatDateTimeData.shtml
Hope this helps U.
Thanks!
Regards,

Dj Dev
0
djdev
12/10/2003 6:56:14 PM
Here's how I do it:


<asp:TemplateColumn HeaderText="Required Date">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "ReqDate", "{0:MM/dd/yyyy}") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id=ReqDate Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ReqDate", "{0:MM/dd/yyyy}") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>


Eric Landes

MADNUG President http://www.madnug.net
Crystal Alliance Editor
Blog http://aspadvice.com/blogs/elandes
Microsoft MVP
0
ericlandes
12/10/2003 6:56:55 PM
Thank you, that worked great.

Rodney
0
rodchar
12/10/2003 7:27:07 PM
Reply:

Similar Artilces:

Dates, Dates, Dates!
Hello all... I am in the process of building an appointment system, and I am trying to see if I can get some pointers on which way to go on this. The first version of this appointment system was very lo-tech, and it stored all of the possible dates/times in the database. Once a user booked an appointment, their information was logged to that date/time, and then that date/time would no longer show in the list of possible openings. This was great for a temporary fix, but with having to pre-populate all of the dates/times, the system would eventually have to be updated to continue on pa...

DATE field to DATE/TIME
Hello, If the field is defined as a DATE and you do: select datefield+1 from mytable Does the ODBC API (actually ASA 9.02 backend) return a field that is DATETIME or a DATE field? It is messing up my compiled application and seems to be coming back as DATETIME. Thank you. -Robert You are correct, the value is being returned as a TIMESTAMP. You can verify this through using the EXPRTYPE() builtin function, as in select exprtype('select datefield+1 from mytable', 1) from dummy which will return TIMESTAMP. Exprtype is documented in the help. You alm...

Hidden Date Field Showing Current Date Time in Insert FormView
I have a formview insert that I need one of the fields to be todays date and to be hidden so the person doesn't see it.  I need to record the time the form was filled out and inserted. If you want to get the date and insert it into a DB record, just use GETDATE() founction in your sql statement, no need to do this in asp.net page 你好! Just FYI o_O Kewl, thanks!!!  I did this per your suggestion and it worked perfectly!INSERT INTO request(emp_id, request_submit_date, request_start_date, request_end_date, request_duration, request_notes, time_off_id) VALUES (@emp_id, GETD...

just Time or date portion of a date/time field
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, In code you could use Dim dt as System.Date Dim day, month, year as integer day = dt.Day month= dt.Month year = dt.Year This also works with DateTime In SQL you could use DATEPART(<datepart>,<datetime>) where <datepart> is the abbreviations mentioned in post 385301 and <datetime> is a...

date/time or date and time
I am setting up an SQL database and I will need to get differences in dates. For example I have a start date, start time, completion date and completion time and I want to get the difference between the start and completion. Would it be better to have one field with both date and time in it, or better to have a date field and a time field? Even though I have already started setting up the tables with seperate fields for date and time I am now leaning toward one field with date/time in it. (Only because that is the way I had to do it when setting up an Excel spreadsheet for a similar ta...

Date entered...add time value to make date/time field
Windows XP Professional InfoMaker v 9.0.2 Build 7509 Our database contains a date/time stamp for when a specific activity happens to each shipment. I would like the users to be able to simply enter a date for a specific work day. I need to get a list of shipments where the time of one activity occurred on the entered date prior to 9:20. How can I create a computed field that will basically concatenate/amend the entered date with 9:20 that will later be used for criteria in returning rows? Thanks in advance for any help you can provide! Rita Palazzi Senior Engineer /...

just Time or date portion of date/time field: SOMEBODY PLS
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, When you pull in a SQL datetime column value into your .NET code, it is usually cast to a .NET DateTime type... something like this: System.DateTime TheDateAndTime = (System.DateTime)someDataReader["MySQLDateColumn"] Then you can use a variety of .NET methods included in the DateTime class to convert to a strin...

Missing date in time/date field
Hi, I noticed that some postings (including mine) don't show the date, just the time of sending the message. What setting do I need to change to enable this? MegaMad - Leo MegaMad wrote: > Hi, > > I noticed that some postings (including mine) don't show the date, just > the time of sending the message. > > What setting do I need to change to enable this? > > MegaMad - Leo Any post sent today will only show the time, those same posts will show the date and time tomorrow. -- Brian .. http://www.mozilla.org .. http://ilias.c...

Date time picker not show current date
Hello, my web form has a microsoft datatime picker control, which allow use to select the date for usage, however the tex box ofdatetime picker show up the date which i pulled control over, not show the current date when i run the application. any ideal? Thanks Hi Snowingnow, I don't believe Microsoft makes as DateTime picker for ASP.NET. Are you sure you are using a Microsoft made control? Generally most Date Pickers and Calendars use the SelectedDate property to set the date selected in the calendar. Example: Calendar1.SelectedDate = DateTime.Today Hope this helps.Thanks,Geoffrey Mc...

Formatting date/Time to just show date
I have a weird problem.  In one asp page I have a Gridview that contains dates and my DataformatStriong works to restrict the display to just the date portion. On another page it just doesn't work, and the full date and time is shown. the string I am using is {0:dd/MM/yyyy} I knwo the string is havign some effect because if I add some characters outside the { } then these are correctly treated as literal characters and displays with the data. The data is sourced from a SQL 2005 table and this field is set to type datetime. Any help appreciated. Regards Clive Make sure you c...

Inserting Date into Access Date/Time Field
Everytime i capture a date from an asp:dropdownlist and try to insert it into an access date/time field i keep getting a Data type mismatch in criteria expression error (0x80040e07). is there a way i need to format the data before inserting? Any help would be ace!1 using System; 2 using System.Data; 3 using System.Data.OleDb; 4 using System.Configuration; 5 using System.Web; 6 using System.Web.Security; 7 using System.Web.UI; 8 using System.Web.UI.WebControls; 9 using System.Web.UI.WebControls.WebParts; 10 using System.Web.UI.HtmlControls; 11 12 ...

No date in Date field
I have just installed thunderbird on my system. I migrated from outlook express. All the mail that was there before shows both the date and the time in the date field. However, all mail received by thunderbird only has a time stamp, no date. How do I correct this?? Thanks, Roger _Roger Bailey_ spoke thusly on 29/08/2006 10:09 PM: > I have just installed thunderbird on my system. I migrated from outlook > express. All the mail that was there before shows both the date and the > time in the date field. However, all mail received by thunderbird only has ...

date field = date
i made an news table and i made and option to add and update and delete news from it i need one thing that when someone try to add news the time that he insert the news will be in teh date field of the table and dont the costumer write it   hope that u understand me Hi, did you mean you want to add a column that get current date as its value automaticly? If so, you can do the following in Access2003: 1. add a column with 'Date/Time' data time 2. In the 'Field Properties'->'General' pannel, add a 'Default Value' for it, 3. In the 'Expression Builder', double cli...

How to convert a date field to short date? without time.
I am using a query builder to buld a sql statement which brings me somes fields which are defined as date, and they are brought like this one: 5/17/2006 12:00:00 AM and I just want to bring the 5/17/2006.I tried CONVERT (CHAR(10), Fecha_evento, 101) AS Fecha_evento  It works, for displaying, but when I try to look for the maximun within that field, it interprets it as a string, so I do not get the right value.  Do you have a way to solve this? thanks a lot! There's really no such thing as a date without a time.  If you're having problems with displaying the information ...

Web resources about - Date field showing date and time - asp.net.presentation-controls

Iran reacts with fury after Saudis execute Shi'ite cleric
By Sam Wilkin and Angus McDowall DUBAI/RIYADH (Reuters) - Iranian protesters stormed the Saudi Embassy in Tehran early on Sunday morning as Shi'ite ...

Pathankot attack: Blue beacon atop SP’s hijacked SUV let terrorists speed past checkposts
The terrorists had crossed various checkpoint on Friday. Seeing the blue beacon atop the SP’s vehicle, the policemen saluted and let it through. ...

Trump on terror video: I won't change my message
Republican presidential front-runner Donald Trump is standing behind his comments about Muslims after a terror group released a recruitment video ...

Kendall Jenner Not A Lesbian, Very Much Into Harry Styles
Rumors are swirling about Kendall Jenner’s sexuality yet again. The model is reportedly planning to come out of the closet to her friends and ...

Lily Aldridge Kissed Hubby Caleb Followill on New Year's Eve!
Lily Aldridge plants a kiss on her husband Caleb Followill ‘s cheek in this cute snap from their New Year’s Eve celebrations on Thursday (December ...

Demographics Could Kill The GOP Off But Not In Congress, Not While Pelosi Controls The DCCC
Steve Israel and his new DCCC "chairman" Probably the two top recommendations of the Republican Party's official autopsy gf the Romney campaign ...

'Game of Thrones' author says latest installment delayed
Washington (AFP) - "Game of Thrones" fans were let down, when author George R.R. Martin admitted he had missed a December 31 deadline to complete ...

Chris Brown's Rep Slams Accusations He Punched a Woman
Chris Brown ‘s rep is speaking out after the singer was accused of punching a woman during a private party at his suite at the Palms Casino Resort ...

Bernie Sanders Raises Jaw-Dropping Sum For Campaign In Last Quarter Of 2015
Back in May, when Democratic presidential candidate Bernie Sanders was a long-shot unknown in the primaries, he had one message for those who ...

New Year's Resolutions For These Drivers: Suck Less, Win More
Some years just don’t go as expected, in good ways and bad. But thankfully for professional racing drivers, each year brings with it a points ...

Resources last updated: 1/3/2016 4:24:44 AM