Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Dates dates dates dates... SQL and ASP.NET (http://www.velocityreviews.com/forums/t110738-dates-dates-dates-dates-sql-and-asp-net.html)

David Lozzi 09-29-2005 06:03 PM

Dates dates dates dates... SQL and ASP.NET
 
Howdy,

Users can specify a date in a field labeled dtDate. This field in SQL is a
smalldatetime. When I vew the raw data in the table, it displays 9/29/2008,
and when a user doesn't specify a date it displays as 1/1/1900.

Issue 1) When displaying the records in a datagrid, using basically all
default configs for the datagrid, and a stored proc to query the table, the
dates appear as such: 9/29/2005 12:00:00 AM and 1/1/1900 12:00:00 AM. WHY?!
Why doesn't it display the data thats in the table which is ONLY the date?

Issue 2) What's the best way to deal with the 1/1/1900 date default?

I'm writing a calendar console so if I have to format each date field
everytime I use it, I may go crazy. I would think that this is either a slip
in my script or my workstation is not performing correctly....

Thanks for your help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com





Rob Schieber 09-30-2005 02:18 PM

Re: Dates dates dates dates... SQL and ASP.NET
 
David Lozzi wrote:
> Howdy,
>
> Users can specify a date in a field labeled dtDate. This field in SQL is a
> smalldatetime. When I vew the raw data in the table, it displays 9/29/2008,
> and when a user doesn't specify a date it displays as 1/1/1900.
>
> Issue 1) When displaying the records in a datagrid, using basically all
> default configs for the datagrid, and a stored proc to query the table, the
> dates appear as such: 9/29/2005 12:00:00 AM and 1/1/1900 12:00:00 AM. WHY?!
> Why doesn't it display the data thats in the table which is ONLY the date?
>


You need to tell your application how to format the strings: see
http://msdn.microsoft.com/library/de...matstrings.asp


> Issue 2) What's the best way to deal with the 1/1/1900 date default?


I think this is an input validation issue, make sure users enter a date,
or find some way to handle the display of null or default dates. Bottom
line, you need to provide the logic for this.

>
> I'm writing a calendar console so if I have to format each date field
> everytime I use it, I may go crazy. I would think that this is either a slip
> in my script or my workstation is not performing correctly....



>
> Thanks for your help!!
>



--
Rob Schieber


All times are GMT. The time now is 08:35 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.