Windows Phone 8.1 Hijri Calendar - windows-phone-8.1

How can I covert winrt xaml toolkit calendar Georgian format to Hijri Calendar Is there any way ? Please please help me

Here is how you can covert a date to Hijri calendar.
using System.Globalization;
CultureInfo arSA = new CultureInfo("ar-SA");
DateTime dt = DateTime.Now; //Get from your toolkit calendar
lblLog.Text = dt.ToString("dd/MM/yyyy", arSA);
Hope this helps.

Related

How to get Date from Google Sheet and convert string to Date in Google Script to be used for createAllDayEvent?

The goal is to create a variable in google script and create a calendar event. I'm using the following code:
var title = sheet.getRange(row, getColIndexByName("Title")).getValue();
var startDate = sheet.getRange(row, getColIndexByName("Date")).getValue();
var sDate = new Date("startDate");
CalendarApp.getCalendarById(id).createAllDayEvent(title, sDate)
Everything works except the date is not converted to a Date for calendar event.
In order to pass a date value to the Calendar you should also check how you have stored the date in Google Sheets - more precisely in which format.
Moreover, if you want to create a new date you should create it like this:
var sDate = new Date(startDate);
You can also use the formatDate method in Apps Script if you want to format a date with the following parameters: date, timeZone, format.
Reference
Utilities Class Apps Script - formatDate

Converting Unix timestamp in Google App scripts

I am new to Google App Script and am currently working on a project to help myself get familiar with it. My project has a part where I have to convert Unix Timestamp objects in nested JSON to human-readable time. As I don't know about converting timestamps in Google App scripts, I looked into the documentation and found "Utilities.formatDate()".
I tried using it on an example timestamp to see how it works and if it can be used for my needs. So I took a timestamp from the data and tried converting it with this code.
function blah () {
var tim = "1572401067";
var formattedDate = Utilities.formatDate(tim, "GMT+5:30", "MM-dd-yyyy HH:mm:ss");
Logger.log(formattedDate);
}
It ends with an error saying:
Cannot find method formatDate(string,string,string). (line 3, file "Code")Dismiss
What am I doing wrong here?
As your error message correctly describes, there is no such function as formatDate(string,string,string). The formatDate function that exists in GAS takes three parameters, where the first one is a Date, and the second and third ones are string's. A correction of your code could look like the following:
function blah() {
var tim = 1572401067;
var date = new Date(tim*1000);
var formattedDate = Utilities.formatDate(date, "GMT+5:30", "MM-dd-yyyy HH:mm:ss");
Logger.log(formattedDate);
}

google apps script convert string to object

I have a question about the date convert:
in sheet, I have a date '05/11/2018', I need to get next date 06/11/2018.
var end=Utilities.formatDate(new Date(coach_date.getTime()+1*3600000*24), 'GMT', 'dd/MM/yyyy');
var start = new Date();
var events = calendar.getEvents(start,end);
it shows the 'end' is string, not object. it has to be getEvents(object,object)
so I used end = new Date(end); it got '11/06/2018', change month from Nov to June.
How could I fix it, then use it on getevents() feature.
Thanks a lot.
Utilities.formatDate() converts the date object into a string. So, use
var end = coach_date.setDate(coach_date.getDate()+1);

Convert date input from HTML to MySQL DB

I'm working with node.js (for an Electron app) and I wanted to know how to convert a date that comes from an HTML input (dd/mm/yyyy), into a correct DATE type for MySQL DB (yyyy-mm-dd) ?
I checked the Moment.js but I don't know how to use it here ?
In moment.js
var moment = require('moment');
var date = moment('12/04/2012', 'DD/MM/YYYY');
var train_date = date.format('YYYYMMDD');
console.log(train_date);

Google Apps Script: Format Date of DateBox

Hello I am new to Google Apps Script and programing in general.
I would like to know if I can create a custom date format for the way a date appears when selected in a DateBox.
I read somewhere to use "Utilities.formatDate()" but I can't seem to get it to work.
This is what I tried: (I used the formating code for the date only as an example. I would rather have something like "MMM-DD-YYYY" or "MMM-YY")
var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");
var grdProjDates = app.createGrid(3,5).setId('GRDprojDates');
grdProjDates.setWidget(0, 0, app.createLabel('Satrting Date'));
grdProjDates.setWidget(0, 4, app.createDateBox().setId('DateProjEnd')
.setName('DateProjEnd')
.setFormat(formattedDate));
Use the setFormat option on the datebox itself, e.g.
app.createDateBox().setId("FormDate").setValue(Today).setFormat(UiApp.DateTimeFormat.YEAR_MONTH_WEEKDAY_DAY);
as referenced here.