Current Baha’i Date
In the top of this page you should see the current Bahá’í date.This uses an external JavaScript file (.js) to insert the current date, defining the Bahá`í months instead of the Gregorian months.
Inserting the Bahá`í date is a little trickier, because not only do you need to have the external JavaScript file inserted the same way as above - you must also insert some JavaScript into the HTML itself where you want the date to be displayed. The external .JS file converts the Gregorian date into the Badí calendar - you should not change anything in this file.
Download bahaidate.js first and place it in the same folder as your HTML file, and then paste the following code into the <head></head> section of your document:<SCRIPT LANGUAGE="JavaScript1.2" src="bahaidate.js"></SCRIPT>
Next, you need to paste some code into the <body></body> section of your HTML document, wherever you want the date to be inserted. Copy and paste the following, making sure that all the text on the line starting with "document.write .." remains on the same line (i.e. it is not supposed to wrap):
<SCRIPT TYPE="text/javascript">
var d = new BahaiDate()
document.write(d.dayName() + ' of ' + d.monthName() + ', ' + d.year + ' BE, (' + d.year + '/' + d.month + '/' + d.day)
</SCRIPT>
If you have problems after that, check to make sure the JavaScript code from above is only four lines long in your document; otherwise that means it wraps, and it should not. If you are comfortable with JavaScript, you can further modify the above script to look like you want, in terms of font sizes and colors - and you can also change how the date is displayed. For controlling the fonts of the date, I would suggest first inserting the code above, and then putting if you want <span class="whatever"></span> tags for using Cascading Style Sheets (CSS).
| The following paid advertising helps sustain Bahaindex.com: |

