473,386 Members | 1,652 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,386 software developers and data experts.

displaying a date w/o the time trail

17
Hi,

I'm using the datagrid view to display transactions. (asp .net 2.0),
one of the bound fields is DateTime type, when displayed on the grid view it shows the full field with it's time stamp i.e. 3/3/2008 12:00:00 AM.

my question is how can i strip it down and only show the date part it on the grid.

hope it make sense.

TIA
Jun 6 '08 #1
3 928
dip_developer
648 Expert 512MB
if you are fetching date from database write a query like

select convert(varchar,dateColumnName,101) from tablename

or you can convert the date to short date string like...

Convert.ToDateTime(yourDateVAlue).ToShortDateStrin g()

this will display only the date
Jun 6 '08 #2
vstud
17
thanks for the reply.

I'm not sure when it's not working for me when i use it inside the asp page.
I'm getting an error on the convert or what ever function. for example:

<asp:AccessDataSource ID="AccessDataSourceID" runat="server" DataFile="c:\asp\trx_DB.mdb"

OnSelecting="AccessDataSourceID_Selecting" SelectCommand="SELECT web_trx.order_number, web_trx.order_date, DateValue( web_trx.trx_date), activation_codes.id_code, activation_codes.activation_code FROM (web_trx INNER JOIN activation_codes ON web_trx.activation_code_id = activation_codes.id_code) WHERE (web_trx.order_date BETWEEN ? AND ?) ORDER BY web_trx.order_date">

<SelectParameters>

<asp:FormParameter DefaultValue="01/01/2005" FormField="txtFromDate" Name="Fromdate"

Type="DateTime" Size="30" />

<asp:FormParameter DefaultValue="01/01/2009" FormField="txtToDate" Name="Todate"

Type="DateTime" Size="30" />

</SelectParameters>

</asp:AccessDataSource>


the code snip will return an error, however if i take the function part out, aka,
DateValue( web_trx.trx_date) all is fine.

any idea why? Do i need to write a c# or Vb seperate function to handle it..?

TIA
Jun 7 '08 #3
CyberSoftHari
487 Expert 256MB
above solution by dip_developer will need c# or Vb seperate function and also refer Problem converting a string into date in vb.net
Jun 7 '08 #4

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

Similar topics

1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
3
by: Evelyn Pabón | last post by:
Hi I'm developing a database with access and I was ask to include in the report the date of issue. But if the date of issue was change It should be included in the footnote area the issue date...
5
by: nbohana | last post by:
I have a windows form with several fields. One of the fields is a date. I use DateTimePicker to enter and format the date. In my SQL table the date si stored as follows "01/10/2005" and this is...
11
by: Mike9900 | last post by:
How can I get the real system date/time if the user fakes the date, for example by setting the system date back. -- Mike
2
by: Boki | last post by:
Hi All, About the date limitation software ( trail software ) If user change their system time/date, is the limitation still work? It seems we need to write something to registry index, does...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
1
by: yogarajan | last post by:
Hi, i have developed web application,I need to compare current date without help off system current date. We are providing a cd of 30days trail version. i need to compare current date without...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.