Как получить непальскую дату на PHP?

Непальский день: сегодня: 2070-10-21 (ГГГГ-ММ-ДД)

И есть сборщик дат для jquery для этого: http://sajanmaharjan.com.np/my-works/nepali-datepicker-ui/

Теперь все, что я хочу, это напечатать 2070-10-21 как сегодняшний день. (например (date (ymd) возвращается как английская дата)

То, что я сделал, это: И это возвращает

<div id="time"> <!-- PRINTING NEPALI DATE AND TIME --> <span class="time_date"> <?php $timezone = "Asia/Kathmandu"; if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone); echo date('l F j, Y');?> &nbsp;| &nbsp; <script type='text/javascript'>var __ndq = __ndq || {format:'W, MD, Y',color:'#555555'};var __sn = document.getElementsByTagName('script'); __sn = __sn[__sn.length-1];(function() {var __nd = document.createElement('script'); __nd.type = 'text/javascript'; __nd.async = true; __nd.src = ('http://') + 'goodies.softnep.com/nepali_date/nep.date.js'; __sn.parentNode.insertBefore(__nd, __sn);})();</script>&nbsp;|&nbsp; <span id="sn_nepalitime"></span></span> <script type="text/javascript"> var currenttime = "<?php echo date('Md,Y h:i:s');?>"; <!--"November 20, 2013 13:19:32"--> var montharray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") var numbers = Array("०", "१", "२", "३", "४", "५", "६", "७", "८", "९"); var serverdate = new Date(currenttime); function padlength(what) { var output = (what.toString().length == 1) ? "0" + what : what return output } function displaytime() { //alert(currenttime); serverdate.setSeconds(serverdate.getSeconds() + 1) var datestring = montharray[serverdate.getMonth()] + " " + padlength(serverdate.getDate()) + ", " + serverdate.getFullYear() hr=padlength(serverdate.getHours()); mi=padlength(serverdate.getMinutes()) ; se=padlength(serverdate.getSeconds()); dd="PM"; if (hr >= 12) { hr = hr-12; dd = "AM"; } if (hr == 0) { hr = 12; } var timestring = hr + ":" + mi + ":" + se +" "+ dd; var arr = timestring.split(""); for (i = 0; i < (arr.length-3); i++) { if (arr[i] != ":") { arr[i] = numbers[arr[i]]; } } timestring = arr.join(""); /* timestring = timestring.replace("AM","gu"); timestring = timestring.replace("PM","gu");*/ document.getElementById("sn_nepalitime").innerHTML = " " + timestring; setTimeout('displaytime()',1000); } displaytime(); </script> <!-- END OF NEPALI DATE AND TIME --> </div> 

Это печатает: среда 5 февраля 2014 года | बुधवार, माघ 22, 2070 | 07:36:45 PM

И я хочу, чтобы он печатался: 2070-10-22

Вот небольшой трюк, чтобы получить даты на непальском языке:

 <?php header('Content-Type: text/plain; charset=utf-8'); $formats = array( IntlDateFormatter::NONE => 'IntlDateFormatter::NONE', IntlDateFormatter::SHORT => 'IntlDateFormatter::SHORT', IntlDateFormatter::MEDIUM => 'IntlDateFormatter::MEDIUM', IntlDateFormatter::LONG => 'IntlDateFormatter::LONG', IntlDateFormatter::FULL => 'IntlDateFormatter::FULL', ); $locale = 'ne_NP'; $time_zone = 'Asia/Katmandu'; foreach($formats as $format => $label){ echo $label . PHP_EOL; $fmt = new IntlDateFormatter($locale, $format, $format, $time_zone, IntlDateFormatter::GREGORIAN); echo $fmt->format(new DateTime) . PHP_EOL; echo PHP_EOL; } 
 IntlDateFormatter::NONE २०१४०२०४ ०६:१७ उत्तर मध्यान्ह IntlDateFormatter::SHORT २०१४-०२-०४ १८:१७ IntlDateFormatter::MEDIUM २०१४ फेब ४ १८:१७:०९ IntlDateFormatter::LONG २०१४ फेब्रुअरी ४ १८:१७:०९ GMT+५:४५ IntlDateFormatter::FULL २०१४ फेब्रुअरी ४, मङ्गलबार १८:१७:०९ GMT+०५:४५