 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 18th, 2004, 05:36 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Time getting displayed along with Date
My Databse in Access has a date Field stored as short Date
i.e mm/dd/yyyy
All values stored in that field are in the above mentioned format
But When I display the date in ASP.net using a Datagrid control
I get the Date as
6/18/2004 12.00.00 AM
How to get rid of this 12.00.00 AM ?
__________________
-.. -..
|
|

June 18th, 2004, 05:38 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
use formatting
formatdatetime(date_field,DateFormat.ShortDate)
Om Prakash
|
|

June 18th, 2004, 07:19 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How can I incorporate this formatting in a query
"select dt from Mytable"
wher dt is the date field of the database
Further , the resultant Data of the query gets bound to a
Datagrid
Quote:
quote:Originally posted by om_prakash
use formatting
formatdatetime(date_field,DateFormat.ShortDate)
Om Prakash
|
|
|

June 18th, 2004, 08:33 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
You can change the format in query as follows:
Select order_date = convert(varchar,orders.order_date,101) from orders
You can always change the formatting in the datagrid
Please check the following thread:
http://p2p.wrox.com/topic.asp?TOPIC_ID=6590
Om Prakash
|
|

August 7th, 2004, 04:44 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Did this work for you? If yes, please let me know. I tried dataformatstring in the datagrid property builder and it did not work, instead it displays "mm/dd/yyyy" on the page.
Thanks
Renu
Quote:
quote:Originally posted by mahulda
My Databse in Access has a date Field stored as short Date
i.e mm/dd/yyyy
All values stored in that field are in the above mentioned format
But When I display the date in ASP.net using a Datagrid control
I get the Date as
6/18/2004 12.00.00 AM
How to get rid of this 12.00.00 AM ?
|
|
|

August 7th, 2004, 10:26 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Renu,
Can you post that part of code here to see what you are missing.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

August 8th, 2004, 02:09 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Vijay-
Here is the select command that I am using and still getting the time with the date:-
Me.SqlSelectCommand1.CommandText = "SELECT JName, JCity, JState, WorkDate = convert(varchar,tbl_jurisdiction.workdate,101) FROM tbl_Jurisdiction"
I also tried the following:-
In the datagrid's property builder, under columns I used the format "mm:dd:yyyy" in dataformatting expression. I am using VS.NET 2003.I am still getting the time.
|
|

August 8th, 2004, 09:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Renu,
Try this.
{0:MM-dd-yyyy}
OR
{0:D} as Dataformatting expression
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

August 9th, 2004, 01:23 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Wow! great! The first one works just fine.
Thanks for your help.
|
|

August 9th, 2004, 11:41 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is the Mpdified Selct Query
Select Format(MyDate,'dd-mm-yyyy')
where MyDate is the Date Field in the Database
This would display 23-10-2004
Quote:
quote:Originally posted by Renu
Did this work for you? If yes, please let me know. I tried dataformatstring in the datagrid property builder and it did not work, instead it displays "mm/dd/yyyy" on the page.
Thanks
Renu
Quote:
quote:Originally posted by mahulda
My Databse in Access has a date Field stored as short Date
i.e mm/dd/yyyy
All values stored in that field are in the above mentioned format
But When I display the date in ASP.net using a Datagrid control
I get the Date as
6/18/2004 12.00.00 AM
How to get rid of this 12.00.00 AM ?
|
|
-.. -..
|
|
 |