11-14-2014 08:13 AM - edited 11-14-2014 08:40 AM
Hello,
I have some problem with the CLD 7, time/date parsing into strings exercise.
I have tested this on two laptops, one is with Win7 x64, UK English, the other Win7 x64 Hungarian language.
On both laptops, if I run the following snippet:
I do not get Week-day info in the string, as in the CLD7 exercise they show. In US English windows, does it provide week day I guess...? Why I do not get weekday info as described in this excercise?
CLD7 pdf is attached.
edit: in the pdf they mention this deviation from EU, but instead of giving a proper example in the solution VI, they just fake a string in the case 🙂 So how can I quickly get day name if my laptop does not live in the Wild West? 🙂
EDIT: I tested this, and if I change the language to US English in the Windows 7 settings: "regio and format", the above snippet does give week day! 🙂 Actually also if it set to German 😄 But UK English misses this feature...
US: Friday, November 14, 2014
HUN: 2014. november 14.
UK: 14 November 2014
GER: Freitag, 14. November 2014
EDIT2: I will ask the NI guys at Munchen about the LabView version and the language settings of the OS, so what system they will give me for the exam. I only specified that I take the exam in English with English LabView...
Solved! Go to Solution.
11-14-2014 08:43 AM
That function uses local settings. That could be a problem for some people. I would recommend using the Format Data/Time String instead. With that function, you specify exactly what you want to see using % codes.
11-14-2014 08:45 AM
thanks, I will use it. I guess there is a % code for week days too, I will check the LV help!
regards,
11-14-2014 08:50 AM
%a is the abbreviated weekday name and %A is the full weekday name.
11-14-2014 08:56 AM - edited 11-14-2014 08:57 AM
what about this? (I just cheated, and checked the solution of the CLD7 challange exercise 🙂 )
Day of week runs from 1 to 7. Today is Friday, and it gave me number 6!!! I said c'mon, it is NOT Saturday today!
Aha, but in the "western" the first day of the week is Sunday (1)... I will never get used to this strange fact that there are countries where the first day of the week is Sunday...since EVERYONE knows that, the first day is Monday...when you go to work in the morning 😄 😄
11-15-2014 01:19 PM
Apparently, not "EVERYONE" would agree. Regardless, it's a programming language. It's not about your work week. You could just as easily ask why the first option is 1 instead of 0. Don't overthink things
11-15-2014 03:00 PM
11-17-2014 01:17 AM - edited 11-17-2014 01:20 AM
Checking the solution is not cheating. 🙂
There is a note in the updated specification: "For solutions using non-US time stamps the parsing will be slightly different. The provided solution is made for a US time stamp, and contains a switch that provides the two strings that would be produced by a US time stamp."
As I remember, this note was missing from the very first version and quite a few people living outside the US noticed the problem.
I agree, using Sunday as the first day of a week might be confusing for many people, especially if Monday means "beginning of the week" on your native language. 🙂
NI´s success package was very helpful when I prepared for my CLD, but this example was not my favourite. I have seen a much better solution somewhere, which was more compacy and elegant than the one provided by NI. I will try to find it, hopefully I saved it for future reference.
11-17-2014 01:29 AM
thanks all for the info!
And natasftw actually pointed out to a more interesting question: everything (as much as i know) is zero-based indexed in LV, but the week-days are not, starting with 1 (Sunday) not zero. It would be interesting to know the reasoning behind this decision in LV.
Regards!
11-17-2014 12:42 PM
@Blokk wrote:
thanks all for the info!
And natasftw actually pointed out to a more interesting question: everything (as much as i know) is zero-based indexed in LV, but the week-days are not, starting with 1 (Sunday) not zero. It would be interesting to know the reasoning behind this decision in LV.
Regards!
LabVIEW Started on the MAC and implemented the cluster in a MAC'y way