Setting a date format to a text box

Dear all,
Please help to set desired date format (dd-mm-yyyy) to a text box. When I got a data (date) from Google sheet, I was unable to get my desired format Even though correct format in Google sheet cell.

Show the exact string (date) that comes back from the google sheet. Does it come back as a (date) number or a string. How is the date setup on the google sheet as a string or as a formatted date number?

IMG_20210414_191654

But in my app
IMG_20210414_191624

Why is the T1 (1 & T) being included ? (Not sure why it is backwards, or is the beginning of the time part of the date. Please show the raw data returned in responseContent.

Sir, it looks like

One way to handle this with blocks is like this:

image

(Draggable to Blocks editor)

You can change the hyphen separator - to a slash / if you want, when setting the date.

OK sir. I try this. Thanks a lot for spending time for me.

Maybe that's a little easier:

With at(list)

atlist

If you used a google apps script to return your sheet contents, you could use:

getDisplayValues()

to return the dates as they look on the sheet

:smiley:

Yes. I have used Google apps script for this app

Yes. This one is a good idea. Thank you.

a simple example (for a script bound to spreadsheet):

function doGet(e) {
  var ss = SpreadsheetApp.getActive();
  var sh = ss.getSheetByName('Sheet1');
  var range = sh.getDataRange(); 
  var data = range.getDisplayValues();
  
  return ContentService.createTextOutput(JSON.stringify(data));
}

Great sir.
In your CRUDQ II apps script, Can we replace "getDisplayValues()" instead of "getValues()"?

Try it, see what happens

Excellent Sir. It works well. In my app, i have used your CRUDQ II apps scrip in my google sheet.
Thank you very much. now i am able to read and update data including dates.

Is there any shortest method to find interval between two different dates? (For example date1 is 01-04-2021 and date2 is 16-04-2021 then the answer - interval is 16days.)

Also you can create a procedure like this

image

1 Like

With no globals, and a separator

image

1 Like