Questions tagged [getdate]
getdate is a T-SQL function available to retrieve the current system date and time.
414
questions
0
votes
0
answers
10
views
Efficient date comparison (DATE portion of DATETIME value within one month)
I need to check if the date portion of dd.eventduedate (a DATETIME value returned by a function) is upcoming within one month. The WHERE clause below works, but I'm concerned that it's inefficient due ...
1
vote
1
answer
70
views
powershell get-date to log file
I'm trying to get a script to test connectivity of a list of IP addresses and log the output to a file. I would like it to put a time/date stamp in the log when when I get no response. I'd like to ...
-1
votes
2
answers
55
views
SQL Using Case with date function
I'm trying to use case for date to run query in SSIS backward 1 month which is
if this month is January must show data of December last year and
if months are in February to December must show data ...
0
votes
1
answer
39
views
NODEJS SEQUELIZE with POSTGRES - fails to create table - getdate() function doesn't exist
I have a node.js application using sequelize as an ORM, which should create tables if they don't exist on a local postgres development database.
The queries created by sequelize all fail where there ...
0
votes
0
answers
31
views
Convert GetDateTime to Time only format [duplicate]
I'm creating an events crud app and am trying to connect the "time" of the event from my database to my code. The data type in the database format is Time(7) and the asp.net code is ...
0
votes
0
answers
27
views
PS - Check a log file for particular text within a certain timeframe
I'm trying to get this to work within a PowerShell script, but it comes back with not defined.
$file = Get-Content "C:\log\clock.log"
$checktime = $(Get-Date).AddHours(-1)
$containsWord = $...
0
votes
1
answer
49
views
Comparing original file and last two files using PowerShell
I have another script that outputs data into a csv file every 4 hours and creates the files as vdsinfo_$(Get-Date -Format "yyMMdd_hh-mm-ss").csv.
I want to be able to compare the original ...
0
votes
1
answer
57
views
SQL Statement working in client but not within SSIS / Visual Studio
my script containes this part which runs fine if its commented out.
where dbname.[Date] > DATEADD(month,-1, Getdate())
when i write this it will work in sql client but ssis ole db source will show ...
0
votes
2
answers
158
views
Look for files with today's date and look for pattern in file, print what found
I'm trying to find the powershell equivalent of this Windows shell command, except now I'm looking for files with today's date:
findstr /S /C:"Firmware version text" C:\Temp\Filename1* & ...
0
votes
0
answers
32
views
SQL For Months with leading Zeros
I have the following query to get
SELECT EntityID, LatestAmortizationMonth, LatestAmortizationYear, SUM(FacilityValueOriginal) AS Original, SUM(PrincipalPaymentToDate) AS PrincipalPmt, SUM(...
1
vote
0
answers
80
views
Is getdate() enough to figure database order of operations?
Suppose we have tables A,B,C,D, and each of them has a column [date1] which we positively know is filled during insert with the getdate() function.
Is it safe to assume that if row R1 on some table ...
0
votes
1
answer
99
views
Select and Convert Date Of Birth from a table to check if their birthdays are today
I have a table called Genericattribute. It's as shown here.
I need to make a Trigger or a query that checks if today is the birthday of any of these employees.
I wrote a query that returns the Ids of ...
0
votes
3
answers
348
views
WHERE date is between [the beginning of the month that was 6 months ago] and now
I use the DATEADD function a lot when working with date ranges, especially if I'm working with rolling time periods. If I wanted to see all results from the past 6 months, I'd of course use...
WHERE [...
0
votes
2
answers
44
views
Get array of distinct date(not time) from array of objects in javascript
Hey I am working on a attendance project in reactjs , I am facing a problem that I received an array of attendances e.g (in range of last two weeks ) . All I need is filter an array of distinct date,...
2
votes
2
answers
118
views
How do I add timestamp (using GETDATE()) to my insert statement?
I'm trying to figure out how to add a timestamp to my database table. df2 doesn't include any column for time so i'm trying to create the value either in values_ or when I execute to sql. I want to ...
0
votes
1
answer
155
views
How to find weekends inside a date array in javascript
I have a date array, what I want is to do two things with it.
1.- Tell me how many dates within it are weekends
2.- Create a new arrangement with the dates that are weekends
I tried the following code ...
0
votes
0
answers
33
views
JDateChooser fulfill with date by selected item from JComboBox which is connected from database Sqlite
Can someone help me? I want JDateChooser — dateChooserBrithIDCard to fill with date based on the selected item in a JComboBox which is connected to a SQLite database. The code shows an option for ...
0
votes
2
answers
47
views
SQL filter between start time of day 0:00 and 22 hours later
I need to create a filter in sql, but I don't know how exactly.
WHERE date < ?? /*I need it to be today until 10pm */ and
date >= getdate() /* I used getdate(), but I don't know if it's the best ...
0
votes
2
answers
73
views
Summing sales dollars for most recent month and 2nd most recent month
For each of the 12 months, I'm looking to create a field that sums the sales dollars at the account level for the most recent month and the 2nd most recent month based on the current date.
For example,...
0
votes
0
answers
31
views
Getdate Function details
Curious to know the differences on how Getdate() is working with respect to SSIS and SQL Server. Is it possible to get the implementation details/Code of Getdate() function for SSIS and SQL Server.
0
votes
1
answer
116
views
Always display 2 digits for date/time with `getDate`
I'm using javascript to display the current (live) date/time on a website. I want all the numbers (date, hour, minute, second) to always display with 2 digits. So if a number is (0-9) it is prefixed ...
0
votes
1
answer
56
views
How to check if a week arrangement is part of the month
I would like to be able to validate in an arrangement that brings me the week, if it is part of the month
I pass a start_date to my function, then check if that date is part of a week that starts on ...
-1
votes
1
answer
45
views
Filtering an INNER JOIN to get only values that have ending date 30 days from now
I've got this kinda big query that is working as expected, now I want to make another query that returns only rows which have an ending date between today and 30 days from now.
What I've tried:
...
-1
votes
1
answer
952
views
Windows Command Line Powershell error: Missing closing ')' in expression
I'm having trouble formatting this to run as a single command line.
powershell ("$today = [system.datetime](Get-Date); $startTime = $today.AddHours(-4); Get-WinEvent -FilterHashtable @{LogName='...
0
votes
1
answer
26
views
ignore HH:mm:ss from search query
I have the following php code:
$result102=DB::Query("select count(HSEQDepotAuditPk) as total FROM dbo.Audit_HSEQDepotAudits WHERE AuditStatus > 1 AND GETDATE() > AuditEndDate AND ...
3
votes
3
answers
555
views
Does using a function calling GETDATE() in a view consistently give dramatically worse performance than using GETDATE() directly?
I have a function that gets the Monday of the week @X weeks in the past/future. I bolted it together from other code on this website. I believe it goes like this:
CREATE FUNCTION [FOO]
(@X INT)
...
2
votes
3
answers
423
views
Why does Javascript's Date.getDate() .setDate() behave so unpredictably?
Hobbyist coder here, and this problem is above my pay grade. I'm trying to build a dynamic html / css calendar, where the cells are filled in based on today's date. I get today's date, and then try to ...
0
votes
1
answer
76
views
Extract email date issue - Google Script
I tried to extract email content and the sent date to GSheet using google script but I keep receiving error of
TypeError: message.getDate is not a function
My code as follows:
function extractDetails(...
0
votes
2
answers
233
views
Day or Night CHECK in SQL Server
I have a Time_Interval column that should only have the values "day" or "night". It will be "day" if it is from 8AM to 8PM and "night" if it is from 8PM to ...
0
votes
0
answers
675
views
AWS-RDS MSSQL: timestamp for getdate() is wrong: offset by 1 hour even with timezone set as UTC
I have a production RDS instance which is showing an incorrect timestamp. The "UTC" time is off by an hour if I look at it with timezone. See the query output below:
proddb1> SELECT ...
-1
votes
1
answer
79
views
sum number each day javascript / jquery
every day add the value in the div with + 1 a type of counter
...
var i = 1;
$(".teste").each(function () {
i = parseFloat(i) + parseFloat($(this).data("teste"));
});
$(".teste").html(i);
<...
0
votes
1
answer
131
views
Timestamp, Date issue in Google Sheets
I am trying to get a timestamp to show in Col K5:K50 (TimeSubmitted) when col E5:E50 (Total Topics) is edited by a student from a tab each student was assigned with an =IMPORTRANGE command I made for ...
0
votes
3
answers
443
views
Move Files to a Backup Folder every first in the month and Zip the Files
I have never worked with powershell and I only need a program that is always run at the beginning of the month
What should the program do?
At the beginning of the month it should move all data except ...
2
votes
1
answer
451
views
How to get part of a Excel file name in SSIS Expression
I have an SSIS Package that picks up only current date files from a particular folder the name of the Excel files changes dynamically
Filename: XYZDailySettleTransaction_20220314_040117.xlsx
I am able ...
0
votes
1
answer
237
views
Javascript Date Object Off by One Month
I understand that javascript counts the months starting from 0. However, I don't know how to account for this when getting a date in the future.
For example, when attempting to get the date for ...
0
votes
0
answers
253
views
How to use GETDATE in a query [duplicate]
I am querying data with a date I insert at the end of the query at the end of EXEC command but I want to use the GETDATE function to query yesterday if possible since I plan on running these queries ...
0
votes
0
answers
36
views
Variable type of "mon" in PHP getdate() is INT but echoes as STRING
I'm a beginner re-learning to code and building a simple "dashboard" in PHP. I constructed a database with information about my friends, including their date of birth and I want my dashboard ...
1
vote
3
answers
734
views
How to select data using getdate() + time?
I have this code:
select *
from Table
where [Date] >= cast(getdate() - 1 as date)
and [Date] < cast(getdate() + 1 as date)
order by [Date] desc
and I need to change this part:
where [Date] &...
0
votes
1
answer
61
views
show / hide image based on amount of days javascript
I am trying to hide and show images within my div grid using javascript. I want the images to appear if the day is less than 15 and hide if it is greater than 15. I want a new image to appear each day ...
-1
votes
1
answer
55
views
PHP getdate echo if yday equals
Using PHP getdate(); I get the following array output:
Array (
[seconds] => 54
[minutes] => 26
[hours] => 19
[mday] => 10
[wday] => 5
[mon] => 12
[...
1
vote
0
answers
99
views
I would like for the script to NOT run on every Thursday and the last Business day of the month
Edit
I am attempting to make a PowerShell script recognize what day of the week it is and decide whether to run. I have a script that performs the task; however, I need to be able to have it not ...
-1
votes
1
answer
252
views
cast MS Access DATE() to Getdate()
I have an ODBC linked table in MS Access to SQL Server. In a query in MS Access, I have the following expression on a field:
DATE() - [DATE] (a field).
I need to change MS Access function DATE(), i....
0
votes
1
answer
705
views
SQL Convert Date format and Subtract days
I am trying to format GETDATE() '08/10/2021' where it subtracts 9 days from it however I keep getting '2021-09-30 00:00:00.000' with trailing 0...where all I want is just the date in this format '08/...
0
votes
3
answers
368
views
Does SQL Server have any consistency for the result of GETDATE() as time passes?
It seems obvious that if you call GETDATE() in SQL Server in two execution batches sufficiently far enough apart in time, the return values will be different.
On the other hand, if you call GETDATE() ...
1
vote
4
answers
246
views
var d = new Date (); need the days monday to friday
I need to add the days Monday do Friday to a service button, so the button should be shown from Monday to Friday from 9:00 - 12:00 and Monday to Friday from 13:00 to 16:00
Can somebody help me please :...
1
vote
1
answer
360
views
Query data from previous day when month/year changes
In a SQL Server query, I am currently using the clause
WHERE
DAY(trade_date) = DAY(GETDATE()) - 1
AND MONTH(trade_date) = MONTH(GETDATE())
AND YEAR(trade_date) = YEAR(GETDATE())
to ...
0
votes
0
answers
550
views
Alternate method for 'new Date().getVarDate()' for other browser in JavaScript
I am new to JavaScript Date object, I am using the new Date().getVarDate() which will returns ‘VT_DATE’.
new Date().getVarDate()
[date] Wed Jul 21 2021 04:18:43 GMT-0700 (Pacific Daylight Time)
...
1
vote
3
answers
3k
views
How to find first day of year using 3 years ago from today’s date
I am looking to write how to find the first day of the year (January 1st) from 3 years ago using today’s date. I know I can utilize Getdate() in this and minus 3 years, but need help on the rest.
...
1
vote
2
answers
812
views
How to resolve error with SQL Scalar variable using GETDATE
I'm writing a scalar variable in SQL to define a season year (which starts halfway through a calendar year). It needs to change as the date changes i.e. 2021 for this date, on June 1 2022 then it ...
0
votes
2
answers
214
views
MSSQL fixed getdate() per query
If I need to update a few million rows with the current date, and I update them with the value getdate(), is this the query run time or the specific row runtime? Meaning will all rows have the same ...