how to add days in orient db - sql

How do we add days to dates in Orient db?
select sysdate()+1 from safetyplan;
It is giving same output as sysdate().
1 is not getting added. Can you help me, please?

According to Orientdb doc 2.2:
sysdate() returns the current date time. If executed with no parameters, it
returns a Date object, otherwise a string with the requested
format/timezone.
So one possible way is to convert date object to long using .asLong() method of date object.Then do the necessary addition.Convert it back to date using .asDate() method.
Example:To get a day added to current day use:
select sum(sysdate().asLong(),86400000).asDate() from safetyplan;
Note:we are adding in milliseconds and 1 day=1000*60*60*24 milliseconds
NB:Thought that this answers may help someone and sorry for answering my own question.

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 add 180 days to trandate in suiteflow on event of afterSubmit?

I need to set a custom date field with the value of trandate + 180 days. for example, if trandate is 21/03/2019 then the custom field value should set as 17/09/2019.
I tried doing the simple way {trandate}+180 but NaN is being shown as field value.
I found one field formula ADD_MONTHS(date, integer) but this is for adding months, while client requires is a date exact 180 days ahead of the transaction date.
Can anyone help me in doing that?
If you are using {trandate} then what you have written should work in a formuladate context so first thing is check your syntax.
Sometimes though Netsuite returns everything as strings so the next thing to try is TO_DATE({trandate}) + 180
Not sure about with SuiteFlow, but maybe this will help.
If you are using SuiteScript 1.0
var tranDate=nlapiStringToDate(trandate);
var newTranDate=nlapiAddDays(tranDate,180);
If you are using SuiteScript 2.0
var tranDate=new Date(trandate);
var newTranDate=tranDate.setDate(tranDate.getDate()+180);

How to handle to a certain Date scenario in Selenium script

i have a scenario where on opening the calendar three dates are enabled for the current week lets' say '21,22,23' and then the next day '21' gets disabled and the next dates shown are 22 ,23 ,24 so i would like to handle this in a way so that it would pick the next date automatically the next day. I don"t want to hard code it as the script will fail next day. How should i handle this?Any suggestions. Thanks
Sounds like you need to know the current date, and then the date of tomorrow.
This has been addressed many many times already on Stack Overflow, so search for more details. Also, this seems to be completely unrelated to Selenium, so please edit your Question and its title to correct and clarify.
ZoneId z = ZoneId.of( "Pacific/Auckland" );
LocalDate today = LocalDate.now( z );
LocalDate tomorrow = today.plusDays( 1 );

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

Access SQL for sorting by date with TempVars

im trying to make a query from the use of TempVars
im Using SQL to run the query but every time i try, it return Invalid date value
this is the line that will not work
this returns error
WHERE ((([Table].[Issue Date])>=#[TempVars]![tmpDateFrom]# And ([Table].[Issue Date])>=#[TempVars]![tmpDateTo]#));
this returns fine
WHERE ((([Table].[Issue Date])>=#10/12/12# And ([Table].[Issue Date])>=#11/12/12#));
I have checked the TempVars [tmpDateFrom] and [tmpDateTo] and they out put the date value i need.
Please help
Thank you all or the help.
due to the requirement of the database #Nicarus had the right answer this is the solution for those still wondering.
WHERE ((([Table].[Issue Date])>=[TempVars]![tmpDateFrom] And ([Table].[Issue Date])>=[TempVars]![tmpDateTo]));