Sølvi wrote:So it's written the same way as きょうは, and it all depends on the context?
Well, remember that "konnichi" and "kyou" both mean "today", except "konnichi" is more formal. They are alternate readings for the same kanji. The word "konnichiwa" is shorthand for "konnichi wa atsui desu ne" or a similar statement about the day's weather, schedule, etc. It's been shortened into a greeting, not unlike the way that "God Bless Ye" in English was shortened to "Goodbye".
But their kanji confusion is one of the weirdest things about Japanese.
"Kyou" is a very old Japanese word that predates kanji. The word "konnichi" is newer, being invented after kanji and their pronunciations were adopted from China. 今=kon & 日=nichi.
Because "kyou" has the same meaning, it also came to be written as 今日, despite the fact that 今 is never pronounced きょ and 日 is never pronounced う. "Kyou" is an irregular reading for these kanji. But the word "kyou" is more commonly used than "konnichi", so today, although "kyou" is irregular, it has become the STANDARD reading. 9 times/10, if you see 今日 you can rest assured that it is pronounced "kyou". If it is meant to be pronounced "konnichi" it will usually have furigana. Otherwise, you have to guess "kyou" or "konnichi" based on the formality of the sentence.
Similar things have happened with other Japanese time words:
明後日 = "asatte"/"myougonichi"
明日 = "asu"/"ashita"/"myounichi"
昨日 = "kinou"/"sakujitsu"
一昨日 = "ototoi"/"issakujitsu"
When written as a greeting, "konnichiwa" is almost exclusively written in hiragana: こんにちは. You will also see it written as こんにちわ sometimes, but this is not technically correct.