Ionic Time and Date Picker - ionic-framework

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.

Related

Converting a string contain date and time using to_date function

How to use to_date function in oracle-sqldeveloper to convert a string
May 1 2019 12:00 to date datatype? Does Date in SQL store time too,
or it only stores date? I tried using the to_date function with some
format but it always removes the time part.
If the time is not possible in Date datatype what could be a good alternative?
You can convert your date to a string with (assuming 24-hour values, which seems likely as you don't have an AM/PM marker):
to_date('May 1 2019 12:00', 'Mon DD YYYY HH24:MI', 'nls_date_language=English')
The format elements are in the documentation. I've included the optional third argument to to_date() because your month name has to be interpreted in English, regardless of your session settings.
it always removes the time part
Oracle dates always have both date and time parts, even if the time is set to midnight. You're probably seeing the result of that query as '01-MAY-19'.
Dates don't have any intrinsic human-readable format; Oracle uses its own internal representation, which you generally don't need to worry about.
In most clients and IDEs the session NLS_DATE_FORMAT setting is used to display native dates as strings. For historic reasons that still defaults to DD-MON-YY, despite Y2K, during database creation. it can be changed at database level, and sessions will then inherit that. But each session can override it, e.g. by issuing:
alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'
You can also explicitly convert a date value back to a string, and specify which format elements you want to include, via a to_char() call. Only do that when displaying a value - if you're storing dates or passing them around to functions, always do that as the proper date data type, not as strings. (If you have to pass them outside the database as strings, e.g. to a remote API, you'd usually want to use an ISO-8601 format).
db<>fiddle showing the default output, explicitly formatted as a string (again, for display only - do not store or manipulate dates as string), and with the session format modified.
In SQL Developer you can also go to Tools->Preferences->Database->NLS and change the 'Date format' there - that setting will then apply when you create new sessions, without having to issue alter session each time.

Keeping local Timezone information from an ISO 8601, RFC3339 formatted dates in iOS

I know there are tons of post regarding iso8601 strings and timezones but I could not find anything that really pinpoints the problem I had recently.
I have an ISO 8601 RFC3339 formatted string like: 2021-03-31T12:00:00+03:00.
I want to display the time associated with this date in the local time of the provided date meaning I want exactly "12:00" as the output. If my formatter has dateFormat of HH:mm
If I use an ISO8601DateFormatter to extract the date everything seems to work fine and the associated Date object is 2021-03-31 09:00:00 +0000. Which makes sense since 12:00GMT+3 = 09:00GMT+0
However this completely removes Timezone information from the Date object (which I know is by design on iOS).
While I understand the design behind this (most of the time we eventually should display the time in the user device timezone). There are quite a few exceptions like travel applications where we almost alway want to display the local time of departure/arrival.
My solution was to store the json serialized dates as Strings and use a combination of ISO8601DateFormatter to create the Date object in UTC and a normal DateFormatter that reconstructs the TZ from the +03:00 substring.
What's the best approach to solve this ?

How do I set Date AND time picker in 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.

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.

How to format timestamp in GWT app with given timezone?

I have to format date/time in my gwt app with specific timezone, which is loaded from the server. Possible timezones are like this GMT, GMT+1, GMT-2 etc...
Up to now i used DateTimeFormat to format my timestamps, and they used client's locale.
PLease help.
You can format in any timezone you want with DateTimeFormat, you just have to pass it as the second argument to the format method.
And to obtain a TimeZone object, depending on how you want to present the timezone information (if ever) in the formatted date/time, you can use either createTimeZone(int) or createTimeZone(String) (getting the string out of TimeZoneConstants).