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
22
votes
4 answers

R: xtable and dates

I have the following data: transaction <- c(1,2,3); date <- c("2010-01-31","2010-02-28","2010-03-31"); type <- c("debit", "debit", "credit"); amount <- c(-500, -1000.97, 12500.81); oldbalance <- c(5000, 4500, 17000.81) evolution <-…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
22
votes
8 answers

MySQL - select data from database between two dates

I have saved the dates of a user's registration as a datetime, so that's for instance 2011-12-06 10:45:36. I have run this query and I expected this item - 2011-12-06 10:45:36 - will be selected: SELECT `users`.* FROM `users` WHERE created_at >=…
user984621
  • 46,344
  • 73
  • 224
  • 412
22
votes
2 answers

How can a custom Drupal date format be added?

How do you add a custom Drupal date format. I want to display the date without hours and minutes, but the options don't include it.
vfclists
  • 19,193
  • 21
  • 73
  • 92
22
votes
3 answers

jQuery/JavaScript: Is it a date? (Validate whether is a date)

I have datepicker, but I could not find a way to validate if the user's entry is a date or not AND if it follows the required format (format: yyyy-mm-dd) This is my datepicker: $("input[name='date']").datepicker({ dateFormat: 'yy-mm-dd',…
Omar
  • 11,783
  • 21
  • 84
  • 114
22
votes
7 answers

Localising date format descriptors

What is the best way to localise a date format descriptor? As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation…
ICR
  • 13,896
  • 4
  • 50
  • 78
22
votes
3 answers

Compare 2 dates in format DD/MM/YYYY with javascript/jquery

Suppose I receive two dates from the datepicker plugin in format DD/MM/YYYY var date1 = '25/02/1985'; /*february 25th*/ var date2 = '26/02/1985'; /*february 26th*/ /*this dates are results form datepicker*/ if(process(date2) > process(date1)){ …
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
22
votes
2 answers

September's short form "Sep" no longer parses in Java 17 in en_GB locale

This works with Java 11 but does not work with Java 17 DateTimeFormatter format = DateTimeFormatter.ofPattern("MMM dd, yyyy") .withLocale(Locale.UK); format.parse("Sep 29, 1988"); Java 17 stacktrace: Exception in thread "main"…
steven35
  • 3,747
  • 3
  • 34
  • 48
22
votes
9 answers

PHP loop through months array

This should be easy but I'm having trouble... In PHP how can I echo out a select drop down box that defaults to the current month and has options for 8 months prior (even if it goes in the last year). For example, for this month it would default to…
kimion09
  • 373
  • 2
  • 3
  • 6
22
votes
4 answers

How do I group a date field to get quarterly results in MySQL?

I have a job table that holds jobs and leaddate is the field for the job entry. The result I want to get is the number of jobs I have in each quarter. My query counts jobs of each date in the leaddate field. Here is the query select count(jobid) as…
abnab
  • 846
  • 3
  • 16
  • 32
22
votes
5 answers

Oracle equivalent to SQL Server DATEPART

We need to get the HOUR out of a DATETIME column (expecting values from 0 to 23 to be returned). Is there an Oracle equivalent of the SQL Server DATEPART function?
Raj More
  • 47,048
  • 33
  • 131
  • 198
22
votes
6 answers

Compare date only (without time) in JPA2 (JPQL)

Im trying to compare Calendars with JPA2. The query looks somewhat like that: TypedQuery q = em.createQuery("select r from Record r where r.calendar= :calendar", X.class); Calendar c = foo(); // setting fields and stuff q.setParameter("calendar",…
atamanroman
  • 11,607
  • 7
  • 57
  • 81
22
votes
1 answer

PySpark: Subtract Two Timestamp Columns and Give Back Difference in Minutes (Using F.datediff gives back only whole days)

I have the following sample dataframe. The date_1 and date_2 columns have datatype of timestamp. ID date_1 date_2 date_diff A 2019-01-09T01:25:00.000Z 2019-01-10T14:00:00.000Z -1 B …
PineNuts0
  • 4,740
  • 21
  • 67
  • 112
22
votes
1 answer

Date - Month in bash without leading 0 or space?

Anyone know how to display the date like this? 7-1-2019 I currently have this which adds leading 0 to the month $(LC_ALL=nn_NO.UTF-8 date +'%-d-%m-%Y') like this 7-01-2019 I use these in lynx dump commands
Chris
  • 985
  • 2
  • 7
  • 17
22
votes
5 answers

How to convert Google proto timestamp to Java LocalDate?

We need to convert Google Proto buffer time stamp to a normal date. In that circumstance is there any way to convert Google Proto buffer timestamp to a Java LocalDate directly?
Thirunavukkarasu
  • 361
  • 1
  • 2
  • 13
22
votes
5 answers

Converting Gregorian date to Hijri date

How do you convert Gregorian dates to Islamic Hijri dates using JavaScript?
FuNk
  • 223
  • 1
  • 2
  • 6
1 2 3
99
100