Date converison

I

id10t error

I am working with a tps file where the date they use is something like
75736. This number is the number of days since December 28,1800. I
know how to get this number with the code below

Dim d As DateTime = New DateTime(1800, 12, 28)
MsgBox(DateTime.Today.Subtract(d).Days()) 'returns 75736 on
5/7/08.


However, how can i convert the 75736 to 5/6/2008? Thank you for your
help
 
L

Lloyd Sheen

id10t error said:
I am working with a tps file where the date they use is something like
75736. This number is the number of days since December 28,1800. I
know how to get this number with the code below

Dim d As DateTime = New DateTime(1800, 12, 28)
MsgBox(DateTime.Today.Subtract(d).Days()) 'returns 75736 on
5/7/08.


However, how can i convert the 75736 to 5/6/2008? Thank you for your
help

d.AddDays(75736) will give you todays date.

LS
 
A

Armin Zingler

id10t error said:
I am working with a tps file where the date they use is something
like 75736. This number is the number of days since December
28,1800. I know how to get this number with the code below

Dim d As DateTime = New DateTime(1800, 12, 28)
MsgBox(DateTime.Today.Subtract(d).Days()) 'returns 75736 on
5/7/08.


However, how can i convert the 75736 to 5/6/2008? Thank you for your
help

I guess "convert" means "calculate":

Dim d As Date
d = #12/28/1800#.AddDays(75736)

If needed, you can pass a format string to d.ToString


Armin
 
A

AMercer

Dim dt0 As New DateTime(1800, 12, 28)
Dim dt1 As DateTime = dt0.AddDays(75736)

dt1 is 5/7/2008. I assume your '5/6/2008' is a typo.
 
I

id10t error

      Dim dt0 As New DateTime(1800, 12, 28)
      Dim dt1 As DateTime = dt0.AddDays(75736)

dt1 is 5/7/2008.  I assume your '5/6/2008' is a typo.







- Show quoted text -

Yes it was a typo. Thank you for your help it worked great.
 

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