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

How to select date from a select box using Capybara in Rails 3?

I'm writing a spec for a controller in Rails 3 project using RSpec and Capybara, and I want to select current date from a select box. I tried: select Date.today, :from => 'Date of birth' but the spec fails and I get error: Failure/Error: select…
Aleksandr Shvalev
  • 1,005
  • 2
  • 11
  • 22
23
votes
14 answers

Date arithmetic in Unix shell scripts

I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. I'm using a function to increment a day and another to decrement: IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 …
ggasp
  • 1,490
  • 3
  • 15
  • 24
23
votes
1 answer

Oracle: How to add 6 months to current date

In SQL Server I can do this to add 6 months to the current date: DateAdd(Month, 6, CURRENT_DATE) What is the equivalent in Oracle?
Cheryl
  • 231
  • 1
  • 2
  • 3
23
votes
5 answers

Bash script compare two date variables

I'm trying to compare a date given by a user to a date in a file, basically a text file with lots of dates and times listed. for example the user would enter a date such as 22/08/2007 and a time of 1:00, what i need the script to do is count how…
Xleedos
  • 948
  • 2
  • 9
  • 17
23
votes
3 answers

How can I show greetings like Good Moring, afternoon or evening base on users time in flutter

I want to greet user when they visit my app I have tried using TimeOfDay but it isn't working. TimeOfDay now = TimeOfDay.now(); greetings(String greeting){ var greeting = now; if(greeting <= '11: 59'){ return 'Morning'; } else…
Benkot
  • 265
  • 1
  • 2
  • 6
23
votes
2 answers

Pandas - Converting date column from dd/mm/yy hh:mm:ss to yyyy-mm-dd hh:mm:ss

I have a dataframe (df) that has a date column (column name : sale_date) that stores data in the below format dd/mm/yy hh:mm:ss I am trying to convert it to yyyy-mm-dd hh:mm:ss. Tried with the below but however it still does not convert it to the…
Kevin Nash
  • 1,511
  • 3
  • 18
  • 37
23
votes
6 answers

Get mySQL rows in minute-by-minute time range over multiple hours

I could try doing this by PHP but I think it could be done simply in mySQL. I have rows in mySQL with a date time over multiple hours. I want to return the counts for each minute interval during those multiple hours. GROUP BY MINUTE(date) gives me…
Rio
  • 14,182
  • 21
  • 67
  • 107
23
votes
3 answers

Compute Date out of Timestamp from Binance-API (Python)

I received the servertime from the Binance-API,I try to work with and it looks like this: { "serverTime": 1518440400000 } The question is, how can I compute the date out of this stamp? I tried import…
cosmonaut
  • 414
  • 1
  • 3
  • 14
23
votes
6 answers

JPA - Returning entities that are After StartDate and Before EndDate

I have two dates in my entity. ie. Date startDate; Date endDate; How do I query so that given a date, it will return all entities where the specified date lies between startDate and endDate? I already tried the…
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
23
votes
2 answers

Are Windows timezone written in registry reliable?

I'm creating a c++ project that should works on several timezone. The application receives an event, with a reference timezone, and this event is shown graphically to the user at the correct hour, in his local timezone. For example, an user working…
Jean-Milost Reymond
  • 1,833
  • 1
  • 15
  • 36
23
votes
4 answers

Convert unix timestamp to julian

How can I convert from a unix timestamp (say 1232559922) to a fractional julian date (2454853.03150). I found a website ( http://aa.usno.navy.mil/data/docs/JulianDate.php ) that performs a similar calculation but I need to do it programatically.…
bgoncalves
  • 1,687
  • 3
  • 19
  • 19
23
votes
1 answer

Date and time in UTC - how to store them in postgres?

I am getting my data: date and time in UTC, in a csv file format in separate columns. Since I will need to convert this zone to date and time of the place where I live, currently in summer to UTC+2, and maybe some other zones I was wondering what is…
mycupoftea
  • 361
  • 1
  • 3
  • 8
23
votes
2 answers

How to subtract 4 months from today's date?

I need to declare two dates in "Ymd" format: $toDate and $fromDate. $toDate represents today's date and $fromDate needs to be 4 months earlier than today. $toDate = Date('Ymd'); $fromDate = ? How do I create $fromDate?
Jason94
  • 13,320
  • 37
  • 106
  • 184
23
votes
8 answers

Python get last month and year

I am trying to get last month and current year in the format: July 2016. I have tried (but that didn't work) and it does not print July but the number: import datetime now = datetime.datetime.now() print now.year, now.month(-1)
user3580316
23
votes
3 answers

Use Moment to get month of Date object

I'm sure this is a simple thing but I haven't been able to find the specific syntax in any of the documentation or in any related posts. In order to get a month-picker to work i need to instantiate a new Date object when my controller initializes.…
NealR
  • 10,189
  • 61
  • 159
  • 299