date format

G

Guest

I have a user whose Regional Short Date Format is "MM/dd/yy"
When I fill a DataTable with the values from an Access table, the Date
columns will contain the date like ""04/26/67 12:00:00 AM"
I need to display the dates to the user as MM/dd/yyyy so I format it like
cdate(ds.tables(0).rows(0).item("birthdate").tostring).ToString("MM/dd/yyyy")

The problem is that since the century is not in the column's value, years
like 2964 will be formatted as 1964.

So... I think my question would be
How do I get the century information into a datatable when the user's
Regional Short Date Format is "MM/dd/yy"
 
G

Guest

Hi,
First you say that the user's format is MM/dd/yy, then how does the user
know in the first place if its 1964 or 2964?
If there is a place from wher user knows that, you can utilize the same
thing to get ur data,
Second, what application caters for year 2900?
HTH..
R. Thomas
 
G

Guest

First you say that the user's format is MM/dd/yy, then how does the user
know in the first place if its 1964 or 2964?

I always format the dates as MM/dd/yyyy when displaying them in grids,
textboxes, etc.
Second, what application caters for year 2900?

Well <g> this one happens to be a typo - it should be 1964. But it caused me
to realize that the Datatable doesn't have century information which is a
problem.
Consider if a date of birth is entered as 01/01/1910. This would be stored
in Access as 01/01/1910 as it should. But, if the users Regional Short Date
Format is "MM/dd/yy", when I retrieve the records, the Datatable would have
01/01/10, and if it is formated as in MyDate.Tostring("MM/dd/yyyy"), it will
be 01/01/2010. Wrong!

Thanks for your help!
Brian
 
G

Guest

In case, you have to make sure then when you retrieve the date, you should
retrieve it as dd/MM/yyyy instead of dd/MM/yy.
HTHs...
R. Thomas
 
G

Guest

I would like to retrieve it like that. But... how? It appears to me, that
whatever is retrieved, is formatted like the user's Regional Short Date
Format. So how would I do this??

Thanks a bunch!
Brian
 
G

Guest

cnn = New OleDb.OleDbConnection(Me.ConnectionString)
cnn.Open()
da = New OleDb.OleDbDataAdapter("SELECT * FROM Patients", cnn)
da.Fill(ds, "Patients")

Thanks!
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top