ion-datetime displayFormat how to escape literals in ionic4? - ionic4

I want to have time like 14h 32m. My code:
<ion-datetime displayFormat="HH(h) mm(m)" placeholder="Set Duration">
</ion-datetime>
But ionic treats (h) and (m) as hours and minutes and I have in result: 14(2) 32(32).

well you can put this HH:mm and you should get this 14:32. I don't really know if you can put behind hours or minuts.

Related

toHour and date_trunc functions do not work accurate in clickhouse

I wanna split time field to before hour and after hour part and based on the definition of
date_trunc i am using this code:
date_trunc('hour', time_field)
input: 2022-07-31 20:00:23.000
output: 2022-07-31 19:30:00.000
Why this code changes 20:00:23.000 to 19:30:00.000.
And my second question is about toHour .I am using below code :
toHour(time_field)
input :‍ ‍‍‍‍2‍022-07-31 19:30:00.000‍‍
output : 0
it should be 19 ,why 0?
and when i use:
formatDateTime(time_field, '%Y-%m-%d-%H')
input : 2015-10-18 21:40:13.000
output : 2015-10-19-01
what's the matter with these functions? do i need to convert the time to another timezone?
Thanks to my teammates this issue is resolved finally ! I am sharing the answer with the ones who have this issue. i use dbeaver. so ,it was a client side issue, I have to set use_server_time_zone in dbeaver to make it right
See https://github.com/ClickHouse/clickhouse-jdbc/issues/604.

How to use moment.js to format the v-model data from a vuetify v-text-field (type:time)?

I have this element:
<v-text-field
label="Choose a time"
type="time"
mask="time"
step="1800"
prepend-inner-icon="access_time"
v-model="expiryTime"
:rules="[v => !!v || 'Time is required']"
required
#change="getTime"
></v-text-field>
I want to trigger the getTime method to convert the v-model value into a h:mm format. As I've been testing I have entered 12:00 pm each time as the value for expiryTime and have done the following:
getTime(){
alert(moment().format('h:mm')) //returns current time in x:xx format
alert(this.expiryTime); // Returns '1200'
alert(moment(this.expiryTime).format('h:mm')); // returns '4:26, expect 12:00
alert(moment(this.expiryTime, 'h:mm')); // returns 'Sat Aug 17 2019 12:00:00 GMT-0600', expect 12:00
Basically I'm getting some unexpected values and I don't know why. If I can get the current time in the top alert I am rather confused about how formatting the expiryTime data the same ways ends up being 4:26. And the final alert returns the entire time with the date and etc.
Can someone please explain how I can convert the expiryTime data to be in h:mm format properly?
The moment(String) constructor takes either a ISO 8601 string, or an RFC2822 date time string. If neither of those standards are used, the format must be specified as the second argument of the constructor.
expiryTime (1200) is in the form of hmm, but you had specified h:mm, which would've required a colon between the hour and minutes for moment to parse the date correctly. The fix is to remove the colon.
console.log(moment(1200, 'hmm').format('h:mm'))
console.log(moment(135, 'hmm').format('h:mm'))
console.log(moment(2001, 'hmm').format('h:mm'))
<script src="https://unpkg.com/moment#2.24.0/moment.js"></script>

How to get the time elapsed in seconds between two timestamps in dql?

I'm using Symfony and Doctrine. I'd like to get the time elapsed between two timestamps. Here is a portion of my query (both a.date and q.date are type: timestamp):
$qb->select('a.date - q.date AS elapsed_time');
This gives a numerical result, but I can't tell what the units are. 9 seconds gave me 49, and 60 seconds gave me 99; I can't make sense of that.
I tried this too:
$qb->select('DATE_DIFF(a.date, q.date) AS elapsed_time');
This works, but gives the result in days. I really need minutes or seconds.
Use UNIX_TIMESTAMP instead. try this:
$qb->select('(UNIX_TIMESTAMP(a.date) - UNIX_TIMESTAMP(q.date)) AS elapsed_time');
You need to use the function DATE_FORMAT.
$qb->select(DATE_FORMAT(DATE_DIFF(a.date, q.date), '%s') AS elapsed_time);
Try this. I dont have a mysql console now, but i think it would work.

Splunk date comparison

I need to be able to search for log entries with a specific start date, which has nothing to do with _time. The format is, for example, Start_Date: 08/26/2013 4:30 PM.
I need to add a condition in my search to specify the date, but not the time. I tried strptime and strftime unsuccessfully.
For example, I tried converting start date to a string (without time) and compare it to another string:
"08/26/2013"=strftime(Start_Date, "%d/%m/%Y")
This didn't work either:
"08/26/2013"=strftime(strptime(Start_Date "%d/%m/%Y %I:%M %p"), "%d/%m/%Y")
Any ideas how to solve this?
A * did the trick: Start_Date=08/26/2013*
Answer here: http://answers.splunk.com/answers/100630/splunk-date-comparison

Convert a cell to TimeStamp w Time zone as parameter for SQL Query in Excel 2007

so my query has
where date_trunc('DAY', mh.end) > ?
However when I try to put stuff like "3/31/2012 12:00:00 AM" or "2012-01-31" in the cell, it complains about it not being Timestamp with TIMEZONE format. How can I get it to accept the date? I have been trying to search but I have not found other people having this problem (my search terms might have been off).
Ok I figured it out. I had to convert the date to Text using =TEXT(B1,"yyyy-mm-dd hh:mm:ss") After that it works fine