|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help with DATE data type conversionI've encountered a table that stores dates in Gregorian format so that the
dates and time looks like straight integers that cannot be easily discrened as a date or time by just looking at it. I'm using SQL to query the table and retrieve the data as an integer. I'm tyring to figure out how to best CAST or CONVERT the field into a DATE type so that its readable in the right format. I'm coding in VB.NET and the use of CDATE and FORMAT have both been futile. I realize this is a simple question, but I'm kindly lost so I'm trying not to loose it by spinning my wheels too hard. John John,
The datetime format is a long that exist from ticks. For the SQLserver datetime there is a different starting point than for the system.datetime. The first start with the Georgian calendar in 1753 and the other in the year 1. (1753 was the point where the UK (and therefore there colonies) switched from Julian to Georgian) With CDate that is converted right so that is not the problem. When you want the date as value, than you can use something like this roughly written \\\ dim dtFromSQL as datetime = CDate(dr("DateTime")) dim dtLong as long = dtfromSQL.Ticks /// I hope this helps, Cor
complex grid with comboboxes
Freetextbox.com question Reading from a ini-file and run a program How do I measure the time it takes to copy a file? checkbox in dataset step by step guide to databinding? Positioning a Web Control - Runtime Datagrid 's TextBox input format question. form location Draw text on a image and save the result |
|||||||||||||||||||||||