10-07-2005 01:14 AM
Dear Xu,
1) Is yyyy-mm-dd the ISO datetime format?
2) You mean to say formatting my string as yyyy-mm-dd will work irrespective of the datetime format setting in SQL? If yes, how is that possible?
3) We also use some search queries that locate data between "start" and "end" dates. These are the dates we store in SQL. Until now, we have been saving the date as mm-dd-yyyy and use the same format when building our SQL query. Now, if I start saving the dates in yyyy-mm-dd format, will I also need to make changes in my SQL query?
Thanks,
Gurdas
10-07-2005 01:56 PM
Hi Gurdas,
1. yyyy-mm-dd is the ISO date format, so is yyyymmdd.
2. Actually, yyyymmdd is independent on the SQL settings. yyyy-mm-dd format is dependent on the SQL settings. If people set dateformat to ydm (I think there is very little chance), yyyy-mm-dd will confuse SQL Server. My previous post was based on my memory, I mixed yyyy-mm-dd and yyyymmdd somehow.
3. If you use yyyymmdd format and keep the current setting not changed, you do not need to change your queries. But if the current setting changes, I think you may have to change your queries.
Cheers,
Xu
10-14-2005 12:23 PM
Hi, everyone... I need your help, i need convert to string datetime to stamp datetime, for transfer to DB SQL server.
please it´s importante. thanks
10-15-2005 10:54 AM
12-10-2005 11:47 PM - edited 12-10-2005 11:47 PM
Message Edited by Dynamik on 12-10-2005 11:47 PM
01-02-2008 02:12 PM
01-03-2008 01:28 PM
@JCFC wrote:
(Three years later)
I recently found your VI and use it ... but now the offset is 1461.791666666666740 (LV starts now in 12:00 a.m., Friday, January 1, 1904)
It seems that it's working fine with Access
01-13-2008 11:21 PM - edited 01-13-2008 11:26 PM
Hi JCFC,
Glad somebody (else) found this util useful :^) - and thanks for the pointing-out the inaccuracy/bug!
The extra-8 hours "error" is related to a normal/expected UTC-8 "correction" automatically applied by LabVIEW. Rolfk figured it out in this thread where I posted a tool for obtaining DaylightSavingsTime-independent timestamps (thanks again, RolfK!). I think sometime after 7.1, LabVIEW became able to build timestamps w/out DST compensation, so that tool is becomming obsolete. However,...
I've been using the technique of writing times directly to DB as DBL for three years now, and highly recommend it for avoiding time-string/numeric conversions. Even if somebody-elses code is doing the conversions, the inefficiency and potential for bugs "makes my skin crawl". Three months ago we changed the time-columns of our DB from DBL to datetime-type - it was completely painless, all the timedata was retained and stayed accurate (because datetime types are really DBLs by another name.) BTW, SQL 2000 uses the same fundamental datetime value - days since Jan 01, 1900.
Thanks for the feedback w/bug fix.
Cheers!
01-13-2008 11:53 PM
01-15-2008 05:03 AM