Questions tagged [date]

A date is a reference to a particular day represented within a calendar system, and consists of year, month and day. Use for questions about creating, manipulating and storing date information. Use with any relevant language tags.

A date is an ambiguous interval in time, which usually refers to a day, month, and year in a particular calendar system.

A date by itself (such as Jan 1 2014) does not refer to a specific moment in time.

  • It does not have a time of day, so it refers to a whole calendar date.
  • It does not specify a time zone, so it could be interpreted differently by each viewer.

Related concepts such as "today", "yesterday", and "tomorrow", or any individual day of the week such as "Monday" or "Tuesday", also have the same qualities. They are loose terms that require a time zone in order to lock in to a specific range of time.

In some programming languages, such as , the Date type actually represents a date and time of day and is therefore misnamed.

The most recognized calendar is the Gregorian calendar, but there are other known calendars such as the Hebrew or the Hijri (Muslim) calendar. Since both start at a different date from the Gregorian calendar's date, the dates in these calendars are different. When one intends to implement an international application or website, the different calendars might be good to be taken into account.

See also: , , and

76185 questions
23
votes
7 answers

Angular.js format date from json object

My json response look like this: [{"Id":"dab4580b-e24d-49f8-9fd5-2e968b10d3b5","Title":"MVVM-Sidekick 入精","CreatedOn":"\/Date(1390272893353)\/","IsChecked":false},{"Id":"66a0f134-e240-4cc4-96fa-ac3807853ca7","Title":"Windows Phone…
Edi Wang
  • 3,547
  • 6
  • 33
  • 51
23
votes
11 answers

Is there a good date parser for Java?

Does anyone know a good date parser for different languages/locales. The built-in parser of Java (SimpleDateFormat) is very strict. It should complete missing parts with the current date. For example if I do not enter the year (only day and…
Horcrux7
  • 23,758
  • 21
  • 98
  • 156
23
votes
3 answers

Which is the fastest way to extract day, month and year from a given date?

I read a csv file containing 150,000 lines into a pandas dataframe. This dataframe has a field, Date, with the dates in yyyy-mm-dd format. I want to extract the month, day and year from it and copy into the dataframes' columns, Month, Day and Year…
ram
  • 507
  • 1
  • 5
  • 11
23
votes
4 answers

Convert date to unix timestamp in postgresql

I have a table with a column abc carrying the unix timestamp (eg. 13898161481435) and I want to run a between dates select. It would be not efficient to do a where TO_CHAR(TO_TIMESTAMP(abc / 1000), 'DD/MM/YYYY') > '14/01/2014 00:00:00' and…
javadude
  • 1,763
  • 1
  • 19
  • 38
23
votes
6 answers

Hive: Filtering Data between Specified Dates when Date is a String

I'm trying to filter data between September 1st, 2010 and August 31st, 2013 in a Hive table. The column containing the date is in string format (yyyy-mm-dd). I can use month() and year() on this column. But how do I use them to filter data between…
mixedbag99
  • 529
  • 1
  • 4
  • 17
23
votes
4 answers

Subtracting days, months or years from date using php

I have a db table with a date field startBefore in ('Y-m-d') format. There are also 3 other int fields representing years, months and days. What I would like to do is to fill these three fields the new startAfter date in 'Y-m-d' format. For example…
dimoss
  • 479
  • 1
  • 3
  • 10
23
votes
6 answers

easy way to loop over months and years from a given date

I have been trying to write this loop and it just keeps getting more complicated. Basically I want to take a given date and loop through every month until I reach the current month. So if the start date is 11/1/2011 then I want to loop through…
Rochelle C
  • 928
  • 3
  • 10
  • 22
23
votes
5 answers

Why SimpleDateFormat("MM/dd/yyyy") parses date to 10/20/20128?

I have this code: DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); dateFormat.setLenient(false); Date date = dateFormat.parse("10/20/20128"); and I would expect the dateFormat.parse call to throw ParseException since the year I'm…
goe
  • 343
  • 1
  • 4
  • 13
23
votes
2 answers

Can't seem to escape character from PHP date();

I'm trying to make date equal something like: Posted at 06:55 PM on 8/5/13. However I can't seem to get the "on" part work correctly. I've tried backslashing the characters I want, but everytime something like this happens: 06:55 PM o 8/5/13 I can't…
Sunden
  • 843
  • 3
  • 11
  • 24
23
votes
2 answers

Setting a variable date in SQL

In SQL Server Management Studio, I am trying to reference a specific date and time, using a variable for the date, as shown below. Declare @specified_date Date set @specified_date = '07-01-2013' Select * from etc Where CreatedDate >…
Dakota
  • 464
  • 3
  • 7
  • 19
23
votes
5 answers

How to get the day of year in ruby?

What is the best way to get the day of the year for any specific date in Ruby? For example: 31/dec/2009 should return day 365, and 01/feb/2008 should return day 32
Daniel Cukier
  • 11,502
  • 15
  • 68
  • 123
23
votes
7 answers

Get weekdays in English in R

I am using R outside the US and I got everything working in English, but the result of weekdays() is still in Spanish: Day <- seq(as.Date("2013-06-01"), by=1, len=30) weekdays(Day) [1] "sábado" "domingo" "lunes" "martes" "miércoles" …
Renne007
  • 1,087
  • 2
  • 10
  • 13
23
votes
3 answers

How to add date in sqlite database

I have sqlite database private static final String DB_PROCESS_CREATE = "create table " + DB_TABLE_PROCESS + "(" + PROCESS_ID + " integer primary key autoincrement, " + PROCESS_DATE + " date);"; I create it…
Kostya Khuta
  • 1,846
  • 6
  • 26
  • 48
23
votes
13 answers

Find the earliest date among 3 dates

I have three dates in Java: a, b, c. Any or all of these dates may be null. What's the most efficient way of determining the earliest date among a,b,c, without having a massive if-else block?
Ace
  • 821
  • 3
  • 16
  • 37
23
votes
1 answer

How to get today's date in Ruby 1.9.3?

I'm using Ruby 1.9.3, and when I execute Date.today, I get NoMethodError: undefined methodtoday' for Date:Class` I'm pretty confused about this since it does appear to be in the documentation. Though I know this is the documentation for 2.0, but I…
joslinm
  • 7,845
  • 6
  • 49
  • 72