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

DateTime

I used datetime datatype in my database.

After i enter date in my textbox.The date will store into database with time also.
I need to store only date .
pls help me.
It is urgent for me.
May 27 '08 #1
9 1019
Curtis Rutland
3,256 Expert 2GB
I used datetime datatype in my database.

After i enter date in my textbox.The date will store into database with time also.
I need to store only date .
pls help me.
It is urgent for me.
What kind of Database are you using? Sql Server will always store a time with a date. You could strip the time off of the date, but the Sql Server will add a "12:00 AM" onto the date.
May 27 '08 #2
Plater
7,872 Expert 4TB
Just ignore the time then? Just because it stores, does not mean you have to use that part.
May 27 '08 #3
Thank for ur reply.

Actually i retrieve the data from the database into datagrid.I also retrieve the date field.But it display in the datagrid with the format 4/6/08 12.00 am.
but i need to display only date.

Pls help me.
May 28 '08 #4
Curtis Rutland
3,256 Expert 2GB
If this is a DataGrid, use the data formatting expression. You will need to manually add your columns, and in the Data Formatting Expression, you should put something like: {0:dd/MM/yyyy}
that would give 28/5/2008 for today's date. Move the letters around to change the formatting. You can also replace the slashes with whatever delimiter you like. Google FormatString for more options.

If you are using a gridview, the process is similar. You need to edit the column's properties, and include that formatting string in the DataFormatString attribute.

The GridView is easier to work with, in my opinion.

Thank for ur reply.

Actually i retrieve the data from the database into datagrid.I also retrieve the date field.But it display in the datagrid with the format 4/6/08 12.00 am.
but i need to display only date.

Pls help me.
May 28 '08 #5
thank u .i will try.
May 28 '08 #6
malav123
217 100+
Hi shalini,
if you want to extract date at the time of display then use following in query at the place of date.....

convert(varchar(10),insertDate,101) as insertDate.
for example, select convert(varchar(10),insertDate,101) as insertDate from table...


your problem will be solved....


-malav..
May 28 '08 #7
Thank u very much.I got the answer.
May 28 '08 #8
malav123
217 100+
Thank u very much.I got the answer.
there are many codes like 101 to extract particular things from date time......
May 30 '08 #9
malav123
217 100+
Thank u very much.I got the answer.
And it's glad that your problem is solved....
May 30 '08 #10

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

Similar topics

4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
5
by: I am Sam | last post by:
I have created this DateTime object and instanced it I think correctly DateTime myClubNow1=new...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.