Ihave a date filter where there is from and to date my TO date is the current date, but i want my FROM date to be 1 week before the current date is there a way to execute this? i tried the adddays(currdate(), -7)
Usually filters are on the screen to allow users to change the values. However, in your case it seems you are fixing the date range to past one week, they you probably don't even need the date filters on the screen. You could simply provide a selection "Last Week", when user selects it you perform the date range calculation in your logic and fetch the data accordingly.
Does this work when the date you're using in the formula is not an @row cell but just a cell in the same column as the formula? I can't seem to get it to work. I am plugging in dates based on a list of items we have, all based on one date. I want to calculate working days, but I tried the formula listed earlier in this thread with no luck. Any ideas?
I'm trying include a date range with counting the number of applicants within various depts, in certain date ranges, but it's saying incorrect argument set. =COUNTIFS(DISTINCT([Name of Requestor]:[Name of Requestor], [Submission Date]:[Submission Date], AND(@cell > DATE (2023, 9, 30), @cell
I have tried addDays and addWeeks and addDaysLocalTime but keep getting the same incorrect answer. I'm trying to add 14 days or 2 weeks to the current date. Each attempt for 1-12-2017 gets me 1-25-2017 at 7:00 pm. It doesn't even change the time. I've seen plenty of examples on the community but they get me these results. What am I doing wrong.
So new GlideDateTime() gets the time in the system date rather than your TZ. So it is actually giving you day 14 but in your timezone it will show as the wrong date as it's converting back to your timezone which is behind. At least that's my theory because this will work and give you what you are looking for (and will be more reliable.)
I'm trying to set the start_date to today and the end_date two weeks from now. I can't prove it but it looks like ServiceNow counts today as day 1 therefore the 25th is day 14. So I just added 15 days instead and called it done. Argh!
I'm working on a course that involves sorting juveniles with one of the criteria being their age. I'm looking to display each child's age based on the current date, minus X number of days so that the child's birthday the relative no matter when a learner takes the course.
For example, I need a child that is a couple days short of 18 so I'm looking for JavaScript that will calculate the current date minus X number of days to produce a date of birth that would make the child a few days short of 18 (e.g., Feb 16, 2023 minus 6564 days).
// Output the result
console.log(formattedDate);
With this extra info... for these specific cases chatGPT is great...
This code first creates a Date object representing the current date and time. It then subtracts 18 days from this date by creating a new Date object with a timestamp that is 18 days earlier. The resulting date is then formatted as a string in the format "YYYY-MM-DD", which is commonly used for dates in web applications. Finally, the result is output to the console using the console.log() method.
Spent all day trying to figure this out. The events I'm working with contain a field with an expiration date in Unix epoch time. I'm trying to bring up a table of events when current date is >= 30days before the expiration date. Combed through documentation and Splunk Answers no luck. Thanks in advance.
I did not look closely at your sample data and there is a problem there. It is neither in epoch, nor in any encoding that I can discern. If you can convert this to epoch, then my solution will work for you.
I don't really know how to put this into javascript the correct way or if i need to parse the current date out, if the start date on the form needs to be coming from a date field or if it can be a string field.... I'm assuming it has to be a date field.
For example, to answer the questions, "What date will it be two weeks from today?" or "What date was it two weeks ago?", you can use the day calculator to add days to a date or subtract days from a date. However, it does not let you track the time. You can use the online stopwatch, online alarm clock, and online timer for these tasks.
For the calculation of weeks, months, or years between two dates, use the Count Days tabs. For the addition or subtraction of days, weeks, months, or years from a historical date, use the Add/Subtract tab.
Although you can manually count the number of days between two dates, the day calculator makes it easy and fast. If you manually calculate the duration between two dates, you need to take into account leap years. A typical year consists of 365 days, while a leap year consists of 366 days and occurs once every four years. Using the day calculator will save time because you don't have to worry about the complexities of the Gregorian calendar or work out the number of days in the month (which is sometimes 28, 29, 30, or 31).
You can also use the days from dates calculator to help you work out personal tasks. For example, if you want to return an item with a 30-day return window, you can use the days from dates calculator to work out when the last day is that you can return your item.
I'm trying to put together a search which extracts records in Splunk which are greater than 30 days from the current date using the field generatedAt as the field whereby to calculate the 30 days.
The search runs and correctly doesn't display any events, but to test this, I used the time period as 1 hour because I've entered some test submissions within this time period, but the search still isn't returning any events.
where epoch30daysago>=epochevent will only return events that are more than 30 days old. If you change the time picker to 1 hour but don't change this expression you will still only see events that are older than 30 days, so your events from the last hour will not display.
I've tried the query you kindly provided i.e without the subsearch and it is not returning anything in the fields "epochevent" and "epoch30daysago", so it must be something wrong with the initial query I was using.
Table 9.33 shows the available functions for date/time value processing, with details appearing in the following subsections. Table 9.32 illustrates the behaviors of the basic arithmetic operators (+, *, etc.). For formatting functions, refer to Section 9.8. You should be familiar with the background information on date/time data types from Section 8.5.
In addition, the usual comparison operators shown in Table 9.1 are available for the date/time types. Dates and timestamps (with or without time zone) are all comparable, while times (with or without time zone) and intervals can only be compared to other values of the same data type. When comparing a timestamp without time zone to a timestamp with time zone, the former value is assumed to be given in the time zone specified by the TimeZone configuration parameter, and is rotated to UTC for comparison to the latter value (which is already in UTC internally). Similarly, a date value is assumed to represent midnight in the TimeZone zone when comparing it to a timestamp.
All the functions and operators described below that take time or timestamp inputs actually come in two variants: one that takes time with time zone or timestamp with time zone, and one that takes time without time zone or timestamp without time zone. For brevity, these variants are not shown separately. Also, the + and * operators come in commutative pairs (for example both date + integer and integer + date); we show only one of each such pair.
Add an interval to a timestamp with time zone, computing times of day and daylight-savings adjustments according to the time zone named by the third argument, or the current TimeZone setting if that is omitted. The form with two arguments is equivalent to the timestamp with time zone + interval operator.
Subtract an interval from a timestamp with time zone, computing times of day and daylight-savings adjustments according to the time zone named by the third argument, or the current TimeZone setting if that is omitted. The form with two arguments is equivalent to the timestamp with time zone - interval operator.
Create timestamp with time zone from year, month, day, hour, minute and seconds fields (negative years signify BC). If timezone is not specified, the current time zone is used; the examples assume the session time zone is Europe/London
This expression yields true when two time periods (defined by their endpoints) overlap, false when they do not overlap. The endpoints can be specified as pairs of dates, times, or time stamps; or as a date, time, or time stamp followed by an interval. When a pair of values is provided, either the start or the end can be written first; OVERLAPS automatically takes the earlier value of the pair as the start. Each time period is considered to represent the half-open interval start
When adding an interval value to (or subtracting an interval value from) a timestamp or timestamp with time zone value, the months, days, and microseconds fields of the interval value are handled in turn. First, a nonzero months field advances or decrements the date of the timestamp by the indicated number of months, keeping the day of month the same unless it would be past the end of the new month, in which case the last day of that month is used. (For example, March 31 plus 1 month becomes April 30, but March 31 plus 2 months becomes May 31.) Then the days field advances or decrements the date of the timestamp by the indicated number of days. In both these steps the local time of day is kept the same. Finally, if there is a nonzero microseconds field, it is added or subtracted literally. When doing arithmetic on a timestamp with time zone value in a time zone that recognizes DST, this means that adding or subtracting (say) interval '1 day' does not necessarily have the same result as adding or subtracting interval '24 hours'. For example, with the session time zone set to America/Denver:
3a8082e126