def now = new Date().getTime(); return now;
in kibana scripted fields i am getting current date and time using the above code. the output of the above code is Feb 2, 2021 @ 16:47:24.807
i want to convert this time entirely into minutes. how to do this ?? please help
thank you for your time and help @matw i am able to get the minute of current hour using the code that you gave.
similarly i am able to get the total hours elapsed for the day using
def now = LocalDateTime.ofInstant(Instant.ofEpochMilli(new Date().getTime()), ZoneId.of('Z'));
return now.getHour();
i will multiply this hour value with 60 and get the entire hours elapsed in minutes.
Asked for a simpler version in our painless expert channel, there ain't no, but I wanna give the advise they gave:
you really should pass in a datetime or minutes through parameters as this will just pick up the time when the script happens to run. It will not be consistent.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.