View Full Version : Looking date converter javascript for my country date format
Debendra Oli
11-22-2013, 07:52 AM
Guys i am looking for a date converter java script for my country date format.
Eg.: my country date is
2070/08/07, when the gregoin date is 2013/11/22.
And i wanna Gregoin to my country date converter and my country date to Gregoin date converter java script.
If you can please help me. I will be really pleased to you.
Best regards.
jscheuer1
11-22-2013, 08:12 AM
Here's a converter:
http://www.ashesh.com.np/nepali-date-converter.php
To write it from scratch we would need to know whether or not each day, month, and year corresponds exactly. If they do, simply adding or subtracting so many days will work. If not, the rules of how the two calendars differ would need to be known and used in the conversion.
Debendra Oli
11-23-2013, 09:31 AM
I wanna date converter for my website even through i dont wanna using iframe. So i need javascript can u do it for me...
Are u Nepali?
jscheuer1
11-23-2013, 04:34 PM
I'm not Nepali, no.
Most calendars are not exactly equal. The current Gregorian one has leap years and even leap seconds. Unless the Bikram sambat has the same ones, we can't just add or subtract an equal number of years, months, and days for each conversion. There is also the matter of the number of days in each month. Unless the Bikram sambat months that correspond to the Gregorian months also have the same number of days as those Gregorian months and begin and end on the same dates, determining the correct month and date number in that month would require taking those differences into account. There could be other differences. And depending upon how accurate you want to be, taking into account the time zone difference between the two geographical locations may need to be included.
As I said before, we would need to know the rules that need to be used to convert one type of date to the other. Do you know anywhere that lists those rules?
Debendra Oli
11-23-2013, 05:37 PM
Oh!
I am providing more diffrent information between nepalease date format and gregoien date format!
We have the following month name.
When gregoien month will be:
January 1> Here is Poush 17
Feb 1>Magh 17
Mar 1>Falgun 17
Apr 1>Chaitra 17
May 1>Baisakh 17
Jun 1>Jeth 17
Jul 1>Asadh 17
Aug 1>Srawan 17
Oct 1>Bhadra 17
Sep 1>Asawin 17
Nov 1>Kartik 17
Dec 1>Mansir 17
when here is 17 gregoin will be 1.
Years diffrent is 2070-2013
Gregoin new year starts from Poush 17.
my country timezone is +5:45
First month is Baisakh, second is Baisakh, .....Jeth, Asadh, Swarn, Bhandra, Aswin, Kartik, Mansir, Poush, Magh, Falgun, Chaitra.
Bro pls try for me if you do i will donate you some by heartly.
Bro can i found u in a FB, TWITTER, ETC.
U have website?
djr33
11-23-2013, 05:39 PM
When gregoien month will be:
January 1> Here is Poush 17
Feb 1>Magh 17
Mar 1>Falgun 17
Apr 1>Chaitra 17
May 1>Baisakh 17
Jun 1>Jeth 17
Jul 1>Asadh 17
Aug 1>Srawan 17
Oct 1>Bhadra 17
Sep 1>Asawin 17
Nov 1>Kartik 17
Dec 1>Mansir 17
when here is 17 gregoin will be 1.
Years diffrent is 2070-2013
Gregoin new year starts from Poush 17.
my country timezone is +5:45Is this always true? Does it change from year to year? Is it the same in 2014? 2015? 1999?
And what year is it now? 2013? When does the year end? Which month?
Debendra Oli
11-24-2013, 02:23 AM
Oh you don't understand to me!
Today My country date is 2070/08/09
And gregoin is 2013/11/24
I mean The diffrence between gregoin is that when my country goes 17 gregoin goes 1.
17=1
at last The gregoin and my country is "57 years 3 month 15 days difference.
djr33
11-24-2013, 02:46 AM
Ok. Is that difference always constant?
Are all of the months the same length? Are the years the same length?
It is VERY easy to add 57y+3m+15d to a date. But that won't work unless it is consistent.
For example, in the year 1900 was it still 57y+3m+15d? And in the year 2100, will it be 57y+3m+15d?
jscheuer1
11-24-2013, 04:12 AM
Best I can tell, the Bikram sambat months vary in length from year to year or, probably more accurately stated - from lunar cycle to lunar cycle*. I believe PHP has built in ephemera that can be used to check that during conversion. And I think that's why all the converters I've seen online appear to be server based.
In short, one could easily make a javascript converter that would add 56 Years, 8 Months, and 17 Days to the Gregorian to get the Bikram sambat and vice versa. But there would be many times when it would be off as far as which exact day of which exact month was correct.
* See:
http://calendars.wikia.com/wiki/Bikram_Samwat#Months
for a table that shows each Nepali month as having variable length.
Debendra Oli
11-24-2013, 04:35 AM
Ya he is right!
See a nepali calender 2011-12/2070:
https://m.ak.fbcdn.net/sphotos-g.ak/hphotos-ak-prn2/1399594_541592782598864_1309278348_o.jpg
and do the best.
Pls guys!
Can i found guys in social networking medias?
djr33
11-24-2013, 05:01 AM
Hm. I don't know how to do this. You could approximate it every year and update it as needed, but that still could be complicated.
I would suggest searching for an existing script that uses the format you need, or at least something based on the lunar cycle so the math works out. (There are probably plenty of Islamic calendar scripts out there-- those are lunar I believe; would that work?)
Good luck!
Debendra Oli
11-24-2013, 07:14 AM
Ok, provide me!
jscheuer1
11-24-2013, 03:42 PM
As I said, it will not be accurate in all cases without more detailed knowledge of how the Bikram Sambat months vary. I've searched for that online and haven't found anything more specific than that table I linked to. As a result I added this disclaimer:
Disclaimer: This converter uses javascript only and may be inaccurate for certain dates.
But I decided to go ahead and make the basic script anyway:
http://home.comcast.net/~jscheuer1/side/demos/tidbits/bikram/demo.htm
Use your browser's "View Source" to get the code. I found that the basic conversion (add or subtract 56 years, 8 months, 17 days) would not work exactly with the other math/code I wrote. The 56 years and 8 months seem fine. But for days I found that going from BS to AD required subtracting 15, not 17 days and that going from AD to BS required adding 16, not 17. This may in whole or in part be due to the number of leap years occurring in the intervening 56 years, 8 months. If so, these values may need to be adjusted depending upon that number of leap years. But for current, recent, and near dates, seems fine.
Debendra Oli
11-25-2013, 02:59 AM
Hmm..
This work fine...
Thanks you too many. Many..
Can u add Week result function too?
Bro, Can my user submit their input in Input form not in a "option" method.
E.g.: <input type="text" name="Year"...........etc"/>
And can i show the result in "font type" not in option menu.
E.g.: When User submit a Input form. It would be show as following:
Your Result: "Year/Month/Day - Week of day"
what must i do for make this. Eg.: change/modify in script, or what
Bro, i will be much satisfy for this pls.
Bro, i found that this Dynamic forum site is much useful and important for webmaster/webdeveloper.
I mistakly found this site in Google search, and i thought i am so lucky for finding this awensome forum board.
Bro You Can found more information about Bickram Sambat by online searching "Nepali Calander", "Nepali Date", "Nepali Miti" etc
-Sorry for bad English
jscheuer1
11-25-2013, 02:13 PM
Please don't post so many duplicate/similar posts. If your post doesn't show up right away. Be patient. It can take up to 48 hours for a post to validate.
The script can show the day of the week (Monday, Tuesday, etc.) if that's what you mean:
http://home.comcast.net/~jscheuer1/side/demos/tidbits/bikram/demo3.htm
I have checked Google for all of those searches. I still haven't found anything that tells me how the length of a given Nepali month in a given Nepali year is decided. I'm guessing it has to do with the length of the lunar cycle. But it could be that and something else, or something else completely. Even if it is just the lunar cycle, I'm not sure in what way it relates, or how to take that into account using javascript alone.
And I'm not sure I want to reinvent the wheel. An accurate converter is offered for free:
http://www.ashesh.com.np/nepali-date-converter.php
Example:
http://home.comcast.net/~jscheuer1/side/demos/tidbits/bikram/demo2.htm
I know you say you don't want an iframe. But the advantages of using an accurate converter that's already doing what you want seem to outweigh not wanting an iframe. What is wrong with an iframe anyway? They were once frowned upon, but the latest standard (HTML 5) now includes them as valid elements.
Debendra Oli
11-26-2013, 09:42 AM
O!
Your script is giving one 1 day forward in resulting the BS To AD.
Can my user submit a result in input method, you have done in option method.
Bro, which hosting you r using (free/paid).
Bro, for direct contact to you can i have any social networking medias like facebook, twitter etc.....
jscheuer1
11-26-2013, 01:48 PM
I told you it would be inaccurate for some dates.
You can play with the code and inputs if you like.
My web space is courtesy of my ISP, it's included in the service. It's very limited as far as features go, no PHP or asp, for example.
I can think of no reason why we would need any more direct contact than we have here.
Debendra Oli
11-27-2013, 02:08 AM
Ok !
Bro can i have any online video and mp3 player script for my site by url method?
jscheuer1
11-27-2013, 02:48 AM
Please start a new thread for a new question.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.