|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Serial DateWhat is the easiest way to convert serialdate (like excel has) into real
date in VB.NET? Thank You Peter "Peter" <pczurak@nospam.nospam> schrieb What is a serial date? Is it a Double, an Integer or what? Does it have a > What is the easiest way to convert serialdate (like excel has) into > real date in VB.NET? base date like 1/1/1900? Have a look at the constructors and other members of the DateTime data type. Armin "Armin Zingler" <az.nospam@freenet.de> wrote in message In VB6 you could do the followingnews:uDWuWlOSGHA.2156@tk2msftngp13.phx.gbl... > "Peter" <pczurak@nospam.nospam> schrieb >> What is the easiest way to convert serialdate (like excel has) into >> real date in VB.NET? > > What is a serial date? Is it a Double, an Integer or what? Does it have a > base date like 1/1/1900? Have a look at the constructors and other members > of the DateTime data type. > > > Armin Dim d As Date Dim dbSerial As Double d = Now dbSerial = d +1 ' ' or ' db = 38793.3447800926 d = dbSerial How can I do this in .NET
Show quote
Hide quote
"Peter" <pczurak@nospam.nospam> schrieb Have a look at the members of the DateTime data type. For example:> > "Armin Zingler" <az.nospam@freenet.de> wrote in message > news:uDWuWlOSGHA.2156@tk2msftngp13.phx.gbl... > > "Peter" <pczurak@nospam.nospam> schrieb > > > What is the easiest way to convert serialdate (like excel has) > > > into real date in VB.NET? > > > > What is a serial date? Is it a Double, an Integer or what? Does it > > have a base date like 1/1/1900? Have a look at the constructors > > and other members of the DateTime data type. > > > > > > Armin > > In VB6 you could do the following > > Dim d As Date > Dim dbSerial As Double > > d = Now > dbSerial = d +1 > ' > ' or > ' > db = 38793.3447800926 > d = dbSerial > > > How can I do this in .NET dim d, nextday as date d = now 'or datetime.now nextday = d.AddDays(1) d = DateTime.FromOADate(38793.3447800926) Where do you get the value 38793.3447800926 from? Armin Hi,
AFAIK, An Excel Serial Date is the number of days since 1-1-1900. For eg., Excel stores March 17, 2006, as serial number 38793 because it is 38,793 days after January 1, 1900. The digits after the period in Peter's example are probably the no. of seconds elapsed in that day. Excel stores dates as sequential serial numbers so that it can perform calculations on them. Excel stores January 1, 1900, as serial number 1. But if the members of the DateTime class have any pre-built conversion defined, of that I'm not too sure. Maybe Armin (Who, I have noticed, is our DateTime authority... ;-)) can help here. Regards, Cerebrus.
exe/dll as scheduled task
Icons in Application Menus Access, OLE & VB.NET How To Cancel Edits on a control? Setting Foreground Color Property at Row Level in Datagrid How Many SQL Connections Should I Use? vb.net to c# conversion help please Name 'ADODB' is not declared Error Converting Base 2 Numbers to Base 10 Question re byte arrays and strings |
|||||||||||||||||||||||