• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

how to store vb net dates before 1900

how to store vb net dates before 1900
0
oscarray
Asked:
oscarray
1 Solution
 
x-menIT super heroCommented:
as string
0
 
Don ThomsonCommented:
Actually - If you configure the table to use 4 digit year instead of 2 digit years - you should have no problem

Just use General Date, Long Date or Short Date - (Medium Date is 2 digit year)
0
 
aikimarkCommented:
@oscarray

Datetime values are stored as double precision floating point values.  These are fully capable of handling negative values, which will accommodate 19th century dates.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Shahan AyyubSenior Software Engineer - iOSCommented:
hi!

Why not simply like this?

 
       Dim dt As DateTime = New DateTime(1880, 3, 5)

Open in new window


0
 
Norman MainaCommented:
DateTime datatype in SQL will store that date range ok.

Supported date range =January 1, 1753, through December 31, 9999
http://msdn.microsoft.com/en-us/library/ms187819.aspx
0
 
aikimarkCommented:
where are you persisting the data?

If using SQL Server 2008+, you can use the Date column type to store date (only) values back to the year 1.
http://msdn.microsoft.com/en-us/library/bb630352.aspx

Of course, using the Date column type would mean that you would have to have a separate field for the time component or you could use the Datetime2 column type.
http://msdn.microsoft.com/en-us/library/bb677335.aspx

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now