Example Code

Convert Excel Time Stamp to LabVIEW Time Stamp

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
To demonstrate how to convert excel timestamp to LabVIEW timestamp.

Description:
This VI will covert Excel time stamp into LabVIEW time stamp.

Note -  Excell date format should be MM/DD/YYYY

If Date format is changed, you have to change in the code.

Instructions:
To implement this example:

  1. Define the path of the excel file. Make sure the excel time format is MM/DD/YYYY.
  2. Use range when necessary. Turned off by default.
  3. Run VI.

To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

2017-11-02_9-31-11.jpg 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Regards
Prabhakant Patil

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Prabhakant_Patil
Member
Member
on

Kindly Write the Suggestions, Rating on this example

Prabhakant

Regards
Prabhakant Patil
Srikanth@Siri
Member
Member
on

you have done a good job it is useful for our project.....

Srikanth Kandagatla
Prabhakant_Patil
Member
Member
on

If you get any issue, then please let me know

Prabhakant

Regards
Prabhakant Patil
Abhi3345
Member
Member
on

nice work PC

Prabhakant_Patil
Member
Member
on

Thanks Dude

Regards
Prabhakant Patil
Prabhakant_Patil
Member
Member
on

Please click on like if you like it.

Your valuable suggestions are always welcome for the improvement.

Regards,

Prabhakant

Regards
Prabhakant Patil
mikeporter
Proven Zealot Proven Zealot
Proven Zealot
on

I would like the code more if it gave the correct answer. As it is, the example Read Excel.vi returns values that (compared to the Excel file) are off by several hours. Did you correct for GMT, DST? Oh yes, the example Read_Excel_report.vi gives a different wrong answer.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Prabhakant_Patil
Member
Member
on

Is your excel file has the following format

Note -  Excell date format should be MM/DD/YYYY

If Date format is changed, you have to change in the code.

Regards
Prabhakant Patil
mikeporter
Proven Zealot Proven Zealot
Proven Zealot
on

Actually, I just opened your code and ran it against your excel file and the answers are wrong - the code is overly complex and doesn't handle GMT or DST properly. Also what difference does it make what the format in excel is? That isn't what you are reading.

The date column holds the integer number of days since 12/30/1899. To convert that into the number of days since LV's beginning of time (1/1/1904) you have to add 1462 and then convert to seconds by multiplying by 86400 - both of which you got right. But why the pointless reformatting that follows? Should I go into the problems with your subVI?

The time column from the excel spreadsheet contains the fractional number of days since midnight, multiply that by 86400 and you get the number of seconds since midnight. However you still have to account for both GMT difference and DST to get the time to display correctly in LV. To do that, take the number of seconds you are offset from GMT and if your location is on DST subtract 3600 from that number (the number of seconds in one hour). Now sum this result with the number of seconds since midnight and the number of seconds since midnight 1/1/1904 and convert the result into a timestamp using the To Timestamp function.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Prabhakant_Patil
Member
Member
on

Hi Mike

Thanks for the suggestions.....

I will try this

Prabhakant

Regards
Prabhakant Patil
GriffinRU
Member
Member
on

I think you will find this link helpfull and to support Mike's comments Excel's format won't be an issue.

Enjoy,

-Artur

makadiakishan9922@gmail.com
Member
Member
on

MY PROJECT IS IMAGE PROCESSING BASED SHOPPING COUNTER USING WITH LABVIEW......BUT PRODUCT IS DETECT BUT ITS BILLING PROCESS IS NOT GENRATE....SO PLS HELP ME.........SO PLS GENRATE EXCEL FILE MEANS ONE TYPE OF BILL SYSTEM

shijianshisjian
Member
Member
on

pretty for my job

macroline
Member
Member
on

Can the file be read without the "read file" pop up message? I need to pass the file from the another vi and make read excel.vi  as a sub vi. Kindly help.

0Forest0
Member
Member
on

To correct convert time from excel to labview we shell save and read time zone whith timestamp.