Converting Hijri date to gregorian with jQuery Globalize - jquery-globalization

I am trying to convert a Hijri date back to Gregorian with the internal function in the ar-SA calendar (other calendars seem to have the same toGregorian function). For example code try:
Globalize.cultures["ar-SA"].calendars.standard.convert.toGregorian("1434", "03", "11");
According to sites I've seen like: http://www.islamicity.com/prayertimes/defaulthijriconv.asp
"1434", "03", "11" should be 1/23/2013.
However, each date seems to be off by 2 days and this function returns.. 1/21/2013..
Is there a problem with this function? Or some other issue I could be having by using it?
Or can someone propose a js function which would do the correct conversion?

I figured out the problem it is because Month is zero based so the above code should be:
Globalize.cultures["ar-SA"].calendars.standard.convert.toGregorian("1434", "02", "11");
For todays date.

Related

Converting text into a date not working in google sheets

I have a piece of text I need to transform into a date:
"12/28/20 10:44 PM"
Any of the usual tricks are not working to get sheets to recognize this as a date.
I've made progress parsing out the date and time into separate cells but it still won't factor in the AM PM part.
Is there a quick way to convert to a date for this type of format?
try:
=REGEXREPLACE(A1; "(\d+)\/(\d+)\/(\d+)"; "$2/$1/20$3")*1
then:

How to convert Server Date format in hour or day?

How I will change this date format to in a day or hours
"modifiedTime": "2021-01-30T12:15:14.896Z[GMT]",
"modifiedTime": "2021-01-29T13:58:37.328Z[Etc/UCT]",
DateTime.parse(aString) should handle a Z suffix for timezone or an explicit offset (-05:00). To parse other named timezones, you'll need the https://pub.dev/packages/timezone package, which unfortunately has to get updated at least a few times a year because politicians keep messing with things like DST.

How to format the Date to British Date or US Date and get time from DatePicker

New to MatBlazor below
<MatDatePicker #bind-Value="#Date1"></MatDatePicker>
Want to learn how to get date, format the date and get the time
Does this one has time component?
Thanks
Just get the value from variable Date1 from your component.
Example :
<MatDatePicker #bind-Value="#Date1"></MatDatePicker>
#code{
var formattedValue = Date1.ToString("dd mm yyyy");
var dateValue = Date1.Date;
var timeValue = Date1.TimeOfDay;
}
As the current version, the control have implemented ToLocalTime() default.
Please ask 1 question at a time.
MatDatePicker is based upon mat-datepicker
Best would to look into material design and the ui components for answers to your question
Even though it is for Angular, it gets close, for example look at Angular 6 material: how to get date and time from matDatepicker?

how to change highstock date to persian date

I'm using highcharts. I'm trying to change its date to Persian but since it is using Date.UTC I can not change it!
I've seen the http://api.highcharts.com/highstock#lang but it seems that it doesn't support persian.
Do you know any way to change it into persian date?
One method I can come across with is the algorithm that changes UTC date to Persian date.
Is there any way to solve this problem?
Please help me...
Thank you
You will have to do a bit of work to get this into highcharts.
Firstly, find a javascript library which converts dates to persian date. This one looks promising: http://intldate.codeplex.com/
Secondly, you need to customise the highcharts date formatting. Highcharts provides an API to do this:
http://api.highcharts.com/highcharts#Highcharts.dateFormat()
You need to use the dateFormats hook to add a %P option to the date format string which prints in persian format using the javascript library you choose. Once you have defined a %P format, you can customise the date formats to be used on the x-axis: http://api.highcharts.com/highcharts#xAxis.dateTimeLabelFormats
{
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%P',
week: '%P',
month: '%P',
year: '%P'
}
Note, you can define several dateFormat parameters, not just %P, to handle days, months etc.

Google spreadsheet - how to determine timezone using function

How to use a formula to determine the current timezone?
The formula I use gives an unexpected result.
My spreadsheet settings (File > Spreadsheet settings...):
Time zone: (GMT+01:00) Amsterdam
The formula I used:
=TEXT(NOW(),"HH:mm z")
This gives:
12:47 GMT
Local clock time is 12:47, I would expect the formula to show: "12:47 GMT+1".
I also tried Z instead of z, which gives "12:47 +0000", I would expect +1.
Any suggestions?
I need this so I can determine UTC time and convert to Epoch time ("UTC time" - DATE(1970,1,1)*24*60*60)
You can't do that using formulas w/o javascript checking your local timezone.
As per this form:
https://docs.google.com/a/codeproject.com/spreadsheet/ccc?key=0AqhqY231XZd3cFBiY2VqeWdmNWdaX25zN2lpekthQlE&hl=en_US#gid=4
timezone formatting stuff is not supported in TEXT. This spreadsheet was done by one of Stackoverflow contributors, it is not mine.
So... script?
=TEXT( NOW()+x/24 , "DD/MM/YYYY HH:mm:ss" )
=TEXT( NOW()+8/24 , "DD/MM/YYYY HH:mm:ss" )
The (+x/24) after the NOW function will add x hours (in my case 8) to the standard time. NOW()+1 will give you the time tomorrow so working bakc or forward you can set the formula to give different time zones.
Hope this helps,
Robbie

Resources