LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with timestamp conversion

I am using:
Labview 7.1, LabSQL, MySQL

Here's my attached.
I opted to use timestamp used in MySQL as it is consistenent across all the computers despite of the different format settings in the contol panel.

So right now below are my problems.

1. Using "to timestamp" Vi function does not seem to work. Timestamp in mySQL would look like 20080118084840 which is equivalent to 2008-01-18 08:48:40.
So when I convert  20080118084840 to timestamp. nothing happens. so what's wromg with that?

2.  i would like to convert timestamp to DBL and then to string before writing  to database but i cannot find any fuction. so how do i do that?

Would appreciate your helpful.
Clement
0 Kudos
Message 1 of 6
(3,768 Views)
If you read the help on timestamps, you'd know that LabVIEW calculates this time stamp using the number of seconds elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time. This is nothing like the mySQL "timestamp". This is why you can't take your mySQL format and run it into a timestamp indicator.

To convert the "Get Date/Time In Seconds" VI output to a double, simply insert a "To DBL" numeric conversion.

Here's your VI back with the conversion of current date and time into a format that should work with mySQL.

And since I noted you're using 7.1, here's the screenshot of the block diagram:








Message Edited by Bill@NGC on 02-10-2008 06:51 PM
Download All
0 Kudos
Message 2 of 6
(3,764 Views)
Hi Bill. I begin to understand better. I was looking for shortcut solution.
Thansk a lot.

0 Kudos
Message 3 of 6
(3,758 Views)
Hi Bill. Have you ever used LabSQL before?
I have encountered the problem with timestamp.
When i run mysql commands, like select * from table,  the table that has timestamp. so when I query it in mysqlenvironmental. it outputs like 20080117172155.
However,  when I query using LabSQL and MySQL driver, instead it outputs like 1/17/2008 5:21:55 PM. I would like to use it in the same format for querying later.
it will be difficult to convert it as all PC carry the different settings in the format.
Pls advise
Clement
0 Kudos
Message 4 of 6
(3,733 Views)
I've used the Database Connectivity toolkit with Microsoft Access and Oracle, never used LabSQL or mySQL. Can you post the SQL statement you're using for the SELECT? It's not clear to me exactly what you're trying to do.
0 Kudos
Message 5 of 6
(3,730 Views)
Hi Bill.. thanks.

Here are pics.


Clement


0 Kudos
Message 6 of 6
(3,720 Views)