How do I set Date AND time picker in MDriven? - mdriven

I am trying to capture both date and time in MDriven, but the default for data type DateTime only shows a picker (in Web) for the date, but a time is stored in the persistency layer. How do I also capture the time?

I found this in the wiki.mdriven.net
Date-formatting You set date and time format in the Style attribute
enclosed in { }.
For example, for dates and time, {short} will show date and time in
compact format. The default date format is {shortDate}. Please refer
to the Angular guide for formatting dates
https://docs.angularjs.org/api/ng/filter/date
The date and time format are automatically localized depending on the
browser.

Related

ExtJS Bug when selecting date from datefield

I have a:
Field in my store as date with dateFormat set to 'Y-m-d'
Column in my grid (datecolumn) - format set to 'Y-m-d'
Editor on Column (datefield editor) - format set to 'Y-m-d'
Postgresql Table with a date column (Note, not a timestamp or timestamptz, but date)
I have data that comes into the store from Postgresql like:
{
mydatefield: "2021-07-30"
}
Now, the date do dispay is 100% correct in the grid. Problem comes in when I select a new date, through the datefield editor, let's say
2021-07-31
The moment it saves back to the server it passes:
mydatefield: '2021-07-30T22:00:00.000Z'
and the server saves it wrong as '2021-07-30' and the grid refreshes back to 2021-07-30.
We are on South African Standard Time (+2) Do not know if it something to do with Daylight Saving
So, to recap. It does not matter what date I select, it keeps saving a day less than the day I selected.
The date it's saving is in UTC, which is the timezone you ought to be using on your server(s) and database(s) - that's a good thing as it removes timezone related info and allows dates to be localized to any timezone.
When you transmit date values over the wire between the server and the browser, make sure you're using RFC-8701 formatted strings (what you get when you call new Date().toJSON() in JavaScript). Then you won't have to worry about timezone issues, as RFC-8701 dates are always in UTC. The browser will take care of transforming dates to local time - just call new Date(myRfcDateString).
More info: Storing date/times as UTC in database
Use convert method of store to process data for date column before storing it in store data. Then the store data will be submitted to server in proper format.
There was similar question asked, links below -
Question - Datefield in grid editor
Fiddle - https://fiddle.sencha.com/#view/editor&fiddle/2e0a

Google App Script - how to set date with timezone in AdminReports.UserUsageReport.get()

I'm using Apps Script and trying to extract data from AdminReports.UserUsageReport.get('all', 'the date') (to get classroom last interaction timestamps), but it always comes with records from another day. For example, if I extract from the 5th, the report brings the 6th together, until 7 o'clock in the morning.
The date parameter is a string and in the documentation says the following:
Represents the date the usage occurred. The timestamp is in the ISO
8601 format, yyyy-mm-dd. We recommend you use your account's time zone
for this.
But if the parameter is a string in yyyy-mm-dd format, how am I going to pass the date with the right time zone?
This code not work:
var myDate = new Date(2021,5,5);
var timezone = Session.getScriptTimeZone();
var date = Utilities.formatDate(myDate, timezone, 'yyyy-MM-dd');
var page = AdminReports.UserUsageReport.get('all', date);
How do I use the date correctly?
Thanks a lot.
If the report dates are UTC, then each may first be converted to JavaScript Date objects using
var myDate = new Date('report_date_string');
The second two lines of your code look like they should follow correctly in converting and formatting the Dates to strings in your local time zone.

Ionic Time and Date Picker

I added a time picker in my app but it returns the time in the format HH:MM.
I want the time picker to return the format HH:MM:SS so that the input is compatible with mySQL time format as well.
<ion-input type="time" [(ngModel)]="ChildData.Temperaturedatetime"></ion-input>
Component docs:
The datetime picker provides the simplicity of selecting an exact
format, and persists the datetime values as a string using the
standardized ISO 8601 datetime format. However, it's important to note
that ion-datetime does not attempt to solve all situtations when
validating and manipulating datetime values. If datetime values need
to be parsed from a certain format, or manipulated (such as adding 5
days to a date, subtracting 30 minutes, etc.), or even formatting data
to a specific locale, then we highly recommend using moment.js to
"Parse, validate, manipulate, and display dates in JavaScript".
Moment.js has quickly become our goto standard when dealing with
datetimes within JavaScript, but Ionic does not prepackage this
dependency since most apps will not require it, and its locale
configuration should be decided by the end-developer.

Convert Date Value When Using Google Form Date Picker from 5 Digit Format to MM/dd/yyyy format

I selected tomorrow's date (8/21/2014) from the data picker field of a Google Form submission, and the value "41872" is returned in the spreadsheet.
What format is this date format?
I need to convert this date format to the MM/dd/yyyy format using script, as formatting the Date column using the Format menu only updates the rows that are currently available...not the new rows that will be there when new form submissions come in.
How do I make this conversion?
I am not sure, but your issue seems to be very basic. Its about the cell formatting as like we do in Ms Excel.
For Google spreadsheet inorder to format a cell or a range,
1. Select the Range
2. On menu, Go To Format->Number->Date (and then select the required format)
Does this works?
I had the same confusion. All you need to do is just change the format from the menu Format->Number->Date & Time

Date Column Split in Talend

So I have one big file (13 million rows) and date formatted as:
2009-04-08T01:57:47Z. Now I would like to split it into 2 columns now,
one with just date as dd-MM-yyyy and other with time only hh:MM.
How do I do it?
You can simply use tMap and parseDate/formatDate to do what you want. It is neither necessary nor recommended to implement your own date parsing logic with regexes.
First of all, parse the timestamp using the format yyyy-MM-dd'T'HH:mm:ss'Z'. Then you can use the parsed Date to output the formatted date and time information you want:
dd-MM-yyyy for the date
HH:mm for the time (Note: you mixed up the case in your question, MM stands for the month)
If you put that logic into a tMap:
you will get the following:
Input:
timestamp 2009-04-08T01:57:47Z
Output:
date 08-04-2009
time 01:57
NOTE
Note that when you parse the timestamp with the mentioned format string (yyyy-MM-dd'T'HH:mm:ss'Z'), the time zone information is not parsed (having 'Z' as a literal). Since many applications do not properly set the time zone information anyway but always use 'Z' instead, so this can be safely ignored in most cases.
If you need proper time zone handling and by any chance are able to use Java 7, you may use yyyy-MM-dd'T'HH:mm:ssXXX instead to parse your timestamp.
I'm guessing Talend is falling over on the T and Z part of your date time stamp but this is easily resolved.
As your date time stamp is in a regular pattern we can easily extract the date and time from it with a tExtractRegexFields component.
You'll want to use "^([0-9]{4}-[0-9]{2}-[0-9]{2})T([0-9]{2}:[0-9]{2}):[0-9]{2}Z" as your regex which will capture the date in yyyy-MM-dd format and the time as mm:HH (you'll want to replace the date time field with a date field and a time field in the schema).
Then to format your date to your required format you'll want to use a tMap and use TalendDate.formatDate("dd-MM-yyyy",TalendDate.parseDate("yyyy-MM-dd",row7.date)) to return a string in the dd-MM-yyyy format.