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
3
votes
2 answers

How to configure Highcharts tooltip.headerFormat with getDate() + 5

This should be super simple, but I cannot figure out how JavaScript function getDate works together with Highcharts datetime on xAxis. In my tooltip I want to display two dates in the header, like a date range for instance: 1960/1/1 - 1965/1/1. The…
marialaustsen
  • 105
  • 3
  • 14
3
votes
1 answer

From where does the date in GETDATE() function comes from?

Does Anyone know from where GETDATE() gets the DATE itself?
Golipz
  • 53
  • 6
3
votes
2 answers

getDay() code showing wrong day Javascript

This is my first time (yep JS newbie) using new Date() and getDay() functions in Javascript. The current date given is correct, yet it gives me the day as Friday even thought it shows the day as Thursday if I get current date. I did do a check of…
Jindi
  • 49
  • 7
3
votes
2 answers

Calculating Age of Years in SQL

I need some help with SQL Server 2012 trying to calculate an Aging Years Field for a report. Basically, I have two fields StartDateTime and EndDateTime and here is some sample data below: StartDateTime EndDateTime 2006-10-10…
smul86
  • 401
  • 1
  • 8
  • 22
3
votes
1 answer

Using GETDATE() in a WHILE loop always returns the same value

I understand from sources like this that GETDATE() should always (well, eventually, depending on how fast the loop is) return a different value in a loop. I have this TSQL: DECLARE @WaitUntilTime DATETIME = DATEADD(SECOND, 10, GETDATE()) WHILE…
rory.ap
  • 34,009
  • 10
  • 83
  • 174
3
votes
2 answers

Getting the current date in SQL Server

I searched but wasn't able to find the way to get the date in this format (DD.MM.YYYY) Help me please change this request: DECLARE @date datetime set @date = '01.05.2016' SELECT [User], cast(DATEADD(SECOND, sum(datediff(DAY, @date,[Start])),@date)…
Serg
  • 93
  • 1
  • 10
3
votes
3 answers

Copying a file and adding the date to its name in PowerShell

Why doesn't this work?: Copy-Item "C:\Logs\VPNLog.txt" "C:\Backup\VPNLog$(Get-Date -UFormat %d-%m-%Y-%R).txt" Error message: Copy-Item : The given path's format is not supported. For the record, this works: Copy-Item "C:\Logs\VPNLog.txt"…
Jack Pettersson
  • 1,606
  • 4
  • 17
  • 28
3
votes
2 answers

SQL: All the suggested GetDate () methods are not working

I'm doing an assignment and I was stuck at this place for about couple of days. Getdate () is not working for this procedure. I used all the suggested methods. But again I have to use the update statement here. So aren't there any procedure code to…
3
votes
1 answer

How to count number of work days and hours extracting public holidays between two dates in SQL

I am new to SQL and stuck in some complex query. What am I trying to achieve? I want to calculate following two types of total days between two timestamp fields. Number of Working Days (Excluding Weekend & Public Holidays) Number of Total Days…
Lokapedia
  • 105
  • 1
  • 4
  • 12
3
votes
1 answer

Deterministic function for getting today's date

I am trying to create an indexed view using the following code (so that I can publish it to replication it as a table): CREATE VIEW lc.vw_dates WITH SCHEMABINDING AS SELECT DATEADD(day, DATEDIFF(day, 0, GETDATE()), number) AS SettingDate FROM…
bbailes
  • 371
  • 1
  • 9
3
votes
10 answers

How to replace getDate() from the type Date which is deprecated?

I have an existing program that I have to correct . It contains these lines : Date startDate = new Date(); int day = startDate.getDate() - 1; but getDate() from the type Date is deprecated so i have to change it using Calender.…
Yuri
  • 447
  • 3
  • 9
  • 19
3
votes
1 answer

How to extract date from a DateNow() in YYYYMMDD format in SQL Server

Got a specific requirement that we should extract only date and in YYYYMMDD format from GETDATE() in Sql-Server 2005. How can I accomplish this. Thanks
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
3
votes
5 answers

TSQL Filtering a query by time / hours

Ok, I'm running query builder out of visual studio 2008. I'm trying to filter the results of the query by time; that is, I want to pull everything from the start of yesterday to noon yesterday. I've been using GETDATE()-1 for yesterday, which pulls…
nbpeth
  • 2,967
  • 4
  • 24
  • 34
3
votes
1 answer

DateTime format using t-sql string functions in SQL Server query

Using t-sql string functions substring(convert(varchar, getdate(), 120),6, 11) this will return mm-dd hh:mm But then how do I get datetime format yy-mm-dd hh:mm ? Thank you so much in advance.
Max
  • 229
  • 2
  • 6
  • 18
3
votes
2 answers

Need To Pull Data With Specific Date Range From Current Day In Sql Express 2008

On my table I have a "Datemodified" column. I was to be able to pull results based on that Column. I want to be able to pull anything from 6am to 6pm. This query needs to be able to be used everyday, so the ways I've seen, use a specific date and…
user1800374
  • 75
  • 1
  • 8