Questions tagged [sqldatetime]

The SQLDateTime tag is for questions related to how database SQL queries handle date and time information.

Databases can store date and time information in various ways. The is used for questions related to defining and accessing date/time data. Some considerations for this type of data are

  • Precision
  • Calculations
  • Business rules
  • Scheduling

Most database software allows date types that include both the date and time of day. There are various types of date types that can include timezone information, and interval information.

See the for questions relating to functions used for determining things such as last_day(date) which returns the last day of the month for the specified date, and functions for returning the current date or timestamp.

177 questions
1
vote
2 answers

Date Conversion (String to java.sql.Date) in java

In my code, I've to convert a String value(Input) to java.sql.Date format. The problem I am facing is , the input date format is undefined, and it could be in any format. For example , input string may be "Jan 10,2014" or "01-10-2014" or…
Gokulram
  • 83
  • 7
1
vote
1 answer

Grouping DATETIME by DATE in MySQL and showing the last record of the day

I have a group of currency quotations that change every hour or so. For the sql results in this particular example, I only need the last available record of each day of the last 30 days in yyyy-mm-dd format. This is my current query: SELECT value,…
Andres SK
  • 10,779
  • 25
  • 90
  • 152
1
vote
2 answers

Select distinct where date is max

This feels really stupid to ask, but i can't do this selection in SQL Server Compact (CE) If i have two tables like this: Statuses Users id | status | thedate id | name ------------------------- …
gubbfett
  • 2,157
  • 6
  • 32
  • 54
1
vote
1 answer

sybase get records between two dates, being the dates expressed as VARCHARS

When I execute:    SELECT some_fields FROM some_table WHERE some_other_field BETWEEN '20130901' AND '20131131' I get Error (247) Arithmetic overflow during implicit conversion of VARCHAR value '20131131' to SMALLDATETIME field.**  But when I…
code4jhon
  • 5,725
  • 9
  • 40
  • 60
1
vote
2 answers

Get datetime field in specific format

( SELECT CONVERT(VARCHAR(30),it.EndDate,101))[end] will return date as 06/17/2013 and (SELECT CONVERT(VARCHAR(30),it.StartDate) )[start] will return date as Jun 17 2013 2:00PM and I need date in the following format 06/17/2013 2:00 PM("/" is…
user2471346
1
vote
4 answers

Oracle Insert Multiple Value Shows Error Message

INSERT ALL into instructor values ( 835, 'SPARKS', 4000 , 200, 978, '16-12-1984') into instructor values ( 978, 'STEEL', 5000 , 250, 222, '16-01-1980') and it was: INSERT ALL into instructor values ( 835, 'SPARKS', 4000 , 200, 978,…
weia design
  • 1,250
  • 2
  • 14
  • 22
1
vote
1 answer

Servlet get date and time

I'm using the following code to get the date and time public class offer extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { …
Linga
  • 10,379
  • 10
  • 52
  • 104
1
vote
2 answers

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

I have the below query, giving an error that The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. INSERT INTO ACCount (DocumentNo, AccNo, DueDate, [Description], DC, Amount, Amount1, Amount2,…
fadd
  • 584
  • 4
  • 16
  • 41
1
vote
2 answers

Convert SQLDateTime DayTicks back to DateTime value

I have a date value stored as an integer in a database that was created using the SQLDateTime DayTicks function. How can I reverse engineer that integer value back into a DateTime value?
John44
  • 21
  • 2
1
vote
2 answers

SQL date conversion for 8 char value with 00 as days

I have been having trouble trying to figure out how to properly convert the data. In its current form it is varchar and the data is as follows: 19260200, 19770900, 20030400, 20120300, 20020500, So as you can see I have the year and months, but have…
Johnny B
  • 420
  • 1
  • 5
  • 14
0
votes
4 answers

Sql server date processing issue

I am tired of working this out myself , i cannot understand the way the sql datetime field works its really so bad to understand , its been 2 hours now. Problem: I have a access database and i move it to sql server 2008 r2 table (import all). Now i…
confusedMind
  • 2,573
  • 7
  • 33
  • 74
0
votes
1 answer

com.ibm.db2.jcc.c.SqlException: The syntax of the string representation of a datetime value is incorrect

I'm getting this exception: com.ibm.db2.jcc.c.SqlException: The syntax of the string representation of a datetime value is incorrect while trying to apply java.sql.Date in the format yyyy-mm-DD as the value 2011-12-28 in the Java Code.
Rakesh Sabbani
  • 1,655
  • 5
  • 17
  • 31
0
votes
1 answer

SQL Oracle find records that were made until specified time

I'm quite new to SQL and I got stuck on one thing. Let's say that I have a database, where new records are being created every few mins and there is a 'dstamp' row which contains time when specific rows interfaced into database. I'm trying to write…
Markvet
  • 3
  • 3
0
votes
1 answer

Snowflake sql query to assign weeks to a month

I know about Snowflake date function to find out day, week, month, year, etc. I want to have weeks start from Saturday each week to next Saturday. following gives an idea how to extract, but need something to address my specific case. How to get…
0
votes
3 answers

How to display all columns of the datatype DATE when one column is actually a date and others are just time?

I am learning SQL and using Oracle SQL Developer. I have a table that contains the following columns FlightDate DepartureTime ArrivalTime I have inserted values using either TO_DATE('10:45', 'hh24:mi') or TO_DATE('20/10/2000', 'DD/MM/YYYY') When…
Vonec
  • 13
  • 4