# LabVIEW

cancel
Showing results for
Did you mean:

Highlighted

## Long term countdown timer

I am writing a test that will have an event occur six months from starting and they want a countdown to be displayed on the screen.

I have a simple count down timer and looked at some of the examples here but these seem to be geard fo hours and minutes.

I have always found workgin with time displays confusing in LV

I need a count down to display months, days, hours, minutes, and seconds.

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 1 of 33
(3,007 Views)
Highlighted

## Re: Long term countdown timer

Something like this?  This just does a single calculation, without seconds, but it should be obvious how add in seconds and put it in a continuous loop.  It might have some issues around daylight savings time or leap years, I haven't checked thoroughly.

Message Edited by nathand on 04-16-2009 02:27 PM
Message 2 of 33
(2,987 Views)
Highlighted

## Re: Long term countdown timer

Thank you that should get me going.

I have another question about working with time in LV

When you subtract time it coerces the time and outputs a double

But if you attempt to add time you get broken arrow?

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 3 of 33
(2,968 Views)
Highlighted

## Re: Long term countdown timer

RTSLVU wrote:

When you subtract time it coerces the time and outputs a double

But if you attempt to add time you get broken arrow?

What meaning would it have to add April 14th to July 8th?

Message 4 of 33
(2,966 Views)
Highlighted

## Re: Long term countdown timer

nathand wrote:

RTSLVU wrote:

When you subtract time it coerces the time and outputs a double

But if you attempt to add time you get broken arrow?

What meaning would it have to add April 14th to July 8th?

Ok then how would I say add 6 months 4 hours to 1:02PM April 14 2009?

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 5 of 33
(2,963 Views)
Highlighted

## Re: Long term countdown timer

RTSLVU wrote:

Ok then how would I say add 6 months 4 hours to 1:02PM April 14 2009?

You would use a VI like this.  I just hacked this together based on my reply to a similar question in another thread, there might be some errors around leap years or daylight savings time or other corner cases that I haven't checked.

It's useful to know that a LabVIEW timestamp is essentially a count of seconds since some specific date (midnight January 4, 1904, if I remember correctly), so you can add seconds, hours and days easily.  Months are harder because they may have variable numbers of days.  In general you can treat a timestamp like any other numeric value.  LabVIEW's Date/Time to Seconds and Seconds to Date/Time functions, used in this VI, do the necessary conversion between a number of seconds and an actual date and time (taking into account leap years, daylight savings time, and local time zone).
Message Edited by nathand on 04-16-2009 04:29 PM
Message Edited by nathand on 04-16-2009 04:33 PM
Message 6 of 33
(2,954 Views)
Highlighted

## Re: Long term countdown timer

Sorry about the broken image, I swapped the hours and days on the first upload and just missed the message edit cut-off time to put in the new image, here it is:

Message 7 of 33
(2,945 Views)
Highlighted

## Re: Long term countdown timer

Hello everyone

i am doing a database using excel and labview.

I am able to get the updated date( like the date after 7 days maximum)

but now i want the status automatically

the excel file is like this

date of borrowal   time of borrowal    equipment info   student id    date of returned    status

this one i did

if it is already 7 days and the person dont cme to return the equipment, the status should be alarmed

i dont know how to do it. anybody can help please.

Message 8 of 33
(1,726 Views)
Highlighted

## Re: Long term countdown timer

Are you looking for something like this?

Message 9 of 33
(1,691 Views)
Highlighted

## Re: Long term countdown timer

hmmmm  exactly. only like if that person didnt returned the equipment, it should be alarmed. .. i dont know how to add that to my VI

like i put in here as in the snapshot

date of borrowal: 24/03/2014

time of borrowal: 1.16

equipment specification:

Studnt ID :

date of returned : ( i put a delay of 7). 31/03/2014

status: only this one i need help. how to make it automatic like when the date of 31 is reached.

it should be alarmed ( or put a notification)

Message 10 of 33
(1,683 Views)