Did you try printing out the values? Or single-stepping?
I think the issue is you have misunderstood how Array.split works:
"jueves, enero 12, 2012".split(" 0").join("\n")
Result: jueves, enero 12, 2012
"jueves, enero 12, 2012".split(" ").join("\n")
Your split always fails because the string " 0" never appears.
Thanks for your reply John,
As the matter of fact, I actually do not know how Array.split works, since I am not a programmer, just a designer
As you can see, I am starting from a script already written by a contributor in this forum some time ago.
Googling around I saw that date.toLocaleDateString() in this Windows machine in Spanish should return the date in this format: Jueves, 12 de Enero de 2012 (proven in a web browser). But using this script I get the format mentioned above: jueves, enero 12, 2012. This script is obviously written for English based machines.
I also read something about using the split function to delete the leading zero on single-numbered days. But as I said, I do not understand that very good.
So my issue here is about the date format. What do I have to change to get my correct local date format?
Again, thanks for replying.
What do you have to do? Well, it is tricky. It is tricky to get right. The better answer is "Don't."
But if you must, you'll have to be quite clear.
Exactly what do you want to do to the returend date string?
Specify it very clearly. Something like:
Split it up into space-seperated words.
Insert "de" between the 3rd and 4th word and the 7th and 8th word.
Swap the 3rd and 5th words.
Capitalize the first word.
Put it all back together.
I can imagine many ways to poentially get what you want and as non-Spanish speaker, I am not sure what weird exceptions there are.
The split function divides a string on the specified character. Such as splitting a sentence into words by calling .split(" "), which splits on spaces.