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

PHP Logic, compare against specific date

I need to write a php script that determines the amount the user has to pay depending on the date they register. The later they register the more they pay, so here's the basic code for the script: private $date; function __construct() { …
John Bernal
  • 230
  • 5
  • 21
2
votes
2 answers

How can I Add Time to a Date in jQuery

How do I add 23 hrs 59 min. 59 secs to end_date? var end_date = jQuery('#end_date_datepicker').datepicker('getDate'); //pseudo-code: end_date = (end_date + 23:59:59) I was thinking of trying to convert it to milliseconds, add 86 399 000…
Laxmidi
  • 2,650
  • 12
  • 49
  • 81
2
votes
2 answers

Insert/Update Stored Procedure has conversion error

I am trying to make one stored procedure only in SQL Server that lets the user to choose if he/she wants to add or update a record. Below is my code for my stored pro: CREATE PROCEDURE Sproc_INSERTUPDATE_tblProducts @ProductID bigint, …
user997413
2
votes
2 answers

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 use the GETDATE() redshift function values_ = ',…
kgk
  • 21
  • 2
2
votes
3 answers

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 add days to fill in another 13 days (looping…
Steve M.
  • 55
  • 6
2
votes
1 answer

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 to get XYZDailySettleTransaction_20220314.xlsx…
Adnan Wadekar
  • 53
  • 1
  • 6
2
votes
3 answers

getdate and ctime not working properly

Here is my program time_play.c : #include #include #include int main (void) { char *time_str = "2011-07-20 17:30:18"; time_t time_tm = getdate(time_str); printf("str: %s and time: %s \n", time_str,…
hari
  • 9,439
  • 27
  • 76
  • 110
2
votes
1 answer

Get current week and date of week in react native

I need to display a whole week from Monday To Sunday in following format "Week 2: 05.01 - 11.01" as an example let d = new Date(); let date = d.getDate(); let day = d.getDay(); let currentWeek = Math.ceil((date + 6 - day) / 7); this is what i have…
clockingClock
  • 31
  • 1
  • 3
2
votes
2 answers

Is it possible to insert current datetime in a stored procedure which is designed to insert data?

I've created the following stored procedure: CREATE PROCEDURE dbo.InsertTutees @StudentID INT = NULL, @FirstName VARCHAR(50) = NULL, @Surname VARCHAR(50) = NULL, @Major VARCHAR(50) = NULL, @Timestamp DATETIME = NULL …
codingnoob
  • 49
  • 1
  • 9
2
votes
2 answers

PowerShell returns 2 as week number on January 06 2020

A quick question, apparently today (January 06, 2020) week number should be 2, because there are 53 weeks in 2020. However, the following PowerShell snippet returns 1: (Get-Date -UFormat %V) What is the good approach getting the week number…
Sherzad
  • 405
  • 4
  • 14
2
votes
2 answers

Display employee anniversary dates within the next month or year of current date

basically trying to create a query that will display employee anniversary dates for upcoming month or year of current date, also would like to display a column that shows the years of service SELECT Employee, Hire_Date CASE WHEN…
Teddy
  • 33
  • 7
2
votes
1 answer

set date from one year of getdate ()?

I got a DECLARE statement like this DECLARE ,@ACTIVATE DATETIME, @DEACTIVATE DATETIME I want to set the Activate date as today's date, which is SET @ACTIVATE = GETDATE() I want to set the @DEACTIVATE date to one year from the Activate…
Karamzov
  • 343
  • 1
  • 4
  • 12
2
votes
2 answers

GETDATE() function in SQL server

When running the SQL query: select GETDATE() I get the below output: 2017-10-26 12:48:41.273 It displays the date and the time. But I want the output as 2017-10-26 00:00:00 How to get such a date format?
Che
  • 87
  • 1
  • 1
  • 10
2
votes
2 answers

SQL - Transform GETDATE() into the exactly hour

I've this: SELECT GETDATE() Which gives me : 2017-06-12 16:51:50.410 How can I convert this in order to get: 2017-06-12 16:00:00.000 I've some processes and I'm registering the date and hour of the job but I only want the exactly hour. How can I…
Pedro Alves
  • 1,004
  • 1
  • 21
  • 47
2
votes
3 answers

Exclude weekends from my query

I have a query which is working fine. The query basically retrieves data between 6-8 days old from current date. I'd like exclude the weekends when measuring the age of the data. Example: If a record is registered Friday, then Monday morning it will…
pancake
  • 590
  • 7
  • 24