Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JavaScript Document
- function currentDate() {
- current_time = new Date()
- hour = current_time.getHours()
- if (hour <= 9)
- hour = "0" + hour
- minutes = current_time.getMinutes()
- if (minutes <= 9)
- minutes = "0" + minutes
- seconds = current_time.getSeconds()
- if (seconds <= 9)
- seconds = "0" + seconds
- year = current_time.getYear()
- if (year < 1000)
- year += 1900
- month = current_time.getMonth()
- day = current_time.getDay()
- day_month = current_time.getDate()
- if (day_month <= 9)
- day_month = "0" + day_month
- day_array = ["Domingo", "Segunda-feira", "Terça-Feira", "Quarta-feira", "Quinta-feira", "Sexta-Feira", "Sábado"]
- month_array = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]
- if (hour < 12)
- printable_time = day_array[day] + ", " + day + " de " + month_array[month] + " de " + year + " - " + hour + ":" + minutes + ":" + seconds + " - " + "Bom Dia!"
- else if (hour >= 12 && hour < 19)
- printable_time = day_array[day] + ", " + day + " de " + month_array[month] + " de " + year + " - " + hour + ":" + minutes + ":" + seconds + " - " + "Boa Tarde!"
- else if (hour >= 19 && hour <= 24)
- printable_time = day_array[day] + ", " + day + " de " + month_array[month] + " de " + year + " - " + hour + ":" + minutes + ":" + seconds + " - " + "Boa Noite!"
- document.form_date.date.value = printable_time
- setTimeout("currentDate()",1000)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement