LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate Day of Year


Kevin90 wrote:

how do I get month of year? is there any vi to get that?


 

All you need to do is expand your Unbundle By Name and have the second output be the Month.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 21
(2,620 Views)

When I take the 'month' it's only loading the actual month, but not the past months of this year. With 'day of year' it 's not working. Then I have following problem:

 

- month april only calculate the values from 1.4 - 28.4

- month may calculate 29.4 - 30.4 + 2.5 - 28.5

- month june: 29.5 - 31.5 + 1.6 - 28.6

0 Kudos
Message 12 of 21
(2,584 Views)

If you have special criteria based on the month, then you unbundle just the month value and wire that to the selection tunnel on a case structure.  You can then do whatever special code you need inside of that case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 21
(2,558 Views)

It's not working by unbundle only the month. Then it's only loading the current month.

 

I just need something like 'month of year'

0 Kudos
Message 14 of 21
(2,544 Views)

The VI you posted did not include any data. What is the format you use for the information in Date?  Please give a specific example of what you enter in Data and the result you expect in the indicators.

 

Lynn

0 Kudos
Message 15 of 21
(2,537 Views)

The input date is the current date (Array with year, month and day). 

 

on the attached image:

- left: data in the csv: top(december), bottom(january)

- right: the expected data for june, may and april (top to bottom)

0 Kudos
Message 16 of 21
(2,525 Views)

@Kevin90 wrote:

When I take the 'month' it's only loading the actual month, but not the past months of this year. With 'day of year' it 's not working. Then I have following problem:

 

- month april only calculate the values from 1.4 - 28.4

- month may calculate 29.4 - 30.4 + 2.5 - 28.5

- month june: 29.5 - 31.5 + 1.6 - 28.6


What does all of htis mean?  What are those numbers you are adding and subtracting?

 

The VI you attached is only showing day of year in the Unbundle.  It doesn't show where you tried to access the month and day.

0 Kudos
Message 17 of 21
(2,508 Views)

Kevin90 wrote:

I just need something like 'month of year'


And what would you expect from "Month of Year".  April would be 4, right?  Isn't that what you get from Month?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 18 of 21
(2,500 Views)

With 'month', I only get the current month (July), the past months aren't loaded into the csv file.

0 Kudos
Message 19 of 21
(2,486 Views)

@Kevin90 wrote:

With 'month', I only get the current month (July), the past months aren't loaded into the csv file.


You are making even less sense to me.  That cluster is only a single value based on the Timestamp that was passed into it.  So if you want the month of every item in the CSV, you need to load those timestamps into an array and use a FOR loop to get all of the months.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 20 of 21
(2,479 Views)