You are here: Home » JQuery » Date in hindi format

Date in hindi format

29 Flares 29 Flares ×

Some time we need, date in Hindi format, We can show date in Hindi format with Javascript, just use bellow code for it.
Here i create two array, first for day name and second for month name in Hindi format.

function getYear(), returns current year like 2014,2013….
function getDay(), returns current day like Monday, Tuesday…..
function getMonth(), returns current month like March, April…..
function getDate(), returns current date like 11,12….

<script class="text4" type="text/javascript" language="JavaScript">
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym < 10)
daym="0"+daym
var dayarray=new Array("&#2352;&#2357;&#2367;&#2357;&#2366;&#2352;","&#2360;&#2379;&#2350;&#2357;&#2366;&#2352;","&#2350;&#2306;&#2327;&#2354;&#2357;&#2366;&#2352;","&#2348;&#2369;&#2343;&#2357;&#2366;&#2352;","&#2327;&#2369;&#2352;&#2369;&#2357;&#2366;&#2352;","&#2358;&#2369;&#2325;&#2381;&#2352;&#2357;&#2366;&#2352;","&#2358;&#2344;&#2367;&#2357;&#2366;&#2352;")
var montharray=new Array("&#2332;&#2344;&#2357;&#2352;&#2368;","&#2347;&#2364;&#2352;&#2357;&#2352;&#2368;","&#2350;&#2366;&#2352;&#2381;&#2330;","&#2309;&#2346;&#2381;&#2352;&#2376;&#2354;","&#2350;&#2312;","&#2332;&#2370;&#2344;","&#2332;&#2369;&#2354;&#2366;&#2312;","&#2309;&#2327;&#2360;&#2381;&#2340;","&#2360;&#2367;&#2340;&#2350;&#2381;&#2348;&#2352;","&#2309;&#2325;&#2381;&#2340;&#2369;&#2348;&#2352;","नवंबर","&#2342;&#2367;&#2360;&#2350;&#2381;&#2348;&#2352;")
document.write("&nbsp;"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"&nbsp;");

</script>  

About Abhishek Sinha

I am Abhishek and I love to code on PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Scroll To Top
29 Flares Twitter 3 Facebook 6 Google+ 14 StumbleUpon 3 Pin It Share 0 LinkedIn 3 29 Flares ×