Questions tagged [getdate]

getdate is a T-SQL function available to retrieve the current system date and time.

getdate() is a function that returns the current system date and time in a datetime format in RDBMSs that use T-SQL. It is available for use in MS SQL Server, SAP/Sybase Adaptive Server Anywhere, SAP/Sybase SQL Anywhere and SAP/Sybase IQ.

412 questions
5
votes
1 answer

Get Date From Google Custom Search API

How i can get date data like that google search. Is it possible to get it? I never found it in google custom search API. The second picture i post is only snippet which got date and some description about it. The first picture from google search…
Rushdiey
  • 133
  • 1
  • 1
  • 15
5
votes
1 answer

Accuracy of SYSDATETIME Data Type in SQL Server

I have done some testing using the SYSDATETIME in stored procedure in SQL Server 2008. I have setup a table with a datetime2(7) with a IDENTITY field. I understand the difference between the precision and the accuracy of this data type however, I…
League
  • 113
  • 1
  • 8
5
votes
2 answers

Precision of SQL Getdate?

I am experimenting with a program that inserts data into an SQL 2005 Server database (on XP SP3) at high rate of speed. (This is for collecting timing data so I can evaluate different aspects of my design). My basic set up involves inserting a…
Peter M
  • 7,309
  • 3
  • 50
  • 91
5
votes
4 answers

IDENTITY and GetDate out of order

I have a table with both an IDENTITY column and a DateTime column set by GetDate() like this: CREATE TABLE [MyTable]( [Id] [int] IDENTITY(1,1) , [InsertTime] [datetime] DEFAULT (getdate()), [OtherValues] [int] ) All the INSERTs are…
Per Jakobsen
  • 3,767
  • 17
  • 19
5
votes
2 answers

Between older than 30 days and less than 90days

I need to return records where there is a date older than 30days but less than 90days. so If someone bought something either 31 days ago or 89 days ago its those rows i need to return, ignoring the last 30 days and anything outside of 90days.
GPH
  • 1,817
  • 3
  • 29
  • 50
5
votes
2 answers

Powershell HowTo get last day of 2 month ago

I've a script scheduled every 4th and 14th day of month. when script starts on 4th, I need to get the last day of the previous month (easy, $a.AddDays(-5)) when script starts on 14th, I need to get the last day of 2 month before. for example: 14…
rschirin
  • 1,939
  • 10
  • 34
  • 44
4
votes
3 answers

Why is DATENAME(GETDATE()) giving a different result as DATENAME(2019-02-01) when that is the date today?

I don't understand why DATENAME(GETDATE()) gives a different result from DATENAME(2019-02-01) When that is today's date SELECT GETDATE(), DATENAME(w, GETDATE()),DATENAME(dw, 2019-02-01) Returns: 2019-02-01 14:51:46.017 Friday Monday
While I…
Vincentgsn
  • 53
  • 5
4
votes
4 answers

SQL GetDate() returns wrong time

I am having an issue while using GetDate(), for some reason is not returning the right time (it is 7 hours ahead from the actual time) I am using AZURE and the Database is configured with the right location (West US). I will appreciate any help! I…
Carlos
  • 377
  • 5
  • 24
4
votes
3 answers

GETDATE in DEFAULT constraint on some tables in SQL Server 2012

As u expect I have got problem with GETDATE in DEFAULT constraint on some tables in SQL Server 2012. I have got two tables like below (A and B): CREATE TABLE [dbo].[TABLE_A_OR_B] ( [TABLE_A_OR_B_PK] BIGINT IDENTITY (1, 1) NOT…
SKK
  • 39
  • 1
  • 5
4
votes
6 answers

SQL Query to restrict return dates to current month

I am trying to restrict my returned data to only those points that have start and end dates in the current month - active projects. It is behaving problematically because today is the last day of the month. I believe that tomorrow will be a problem…
Shrout1
  • 2,497
  • 4
  • 42
  • 65
3
votes
1 answer

What could cause GetDate() to cause timeouts?

Every few months a few select pages of a website will start responding with Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. I ran SQL Server Profiler to see where the database is…
Brandon
  • 68,708
  • 30
  • 194
  • 223
3
votes
3 answers

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) RETURNS DATE AS BEGIN RETURN DATEADD(WEEK, @X,…
J. Mini
  • 1,868
  • 1
  • 9
  • 38
3
votes
1 answer

Add days but skip weekends

I have a small problem. I have a working code for adding days depending on the current time (if it is before 10am it adds 1 day if it is after 10am it adds 2 days for the date). So here is my question: How can I edit the code so it will skip the…
Leggeth
  • 33
  • 4
3
votes
4 answers

Get Name and Surname from Username in Google Apps Script

I use a script to automatically insert the date and username to fill in the string. Several people fill out the table. How can I modify the script so that the first name and the last name are inserted instead of the username? function onEdit(e) { …
3
votes
3 answers

Get date closest to today in PHP from database

UPDATE I'm making a backend of a website. The mean point of the website is to give a clear overview to the visitors when and what activities we are organizing. So I filled the database with all kinds of activities. Every activity has a date, a name…
Michiel
  • 7,855
  • 16
  • 61
  • 113
1 2
3
27 28