Questions tagged [days]

A day is a unit of time which is equal to an interval of 24 hours. It may be used for example for measuring the length of a period (see also period tag). For questions about dates or day of week rather consider tags like date or dayofweek.

554 questions
366
votes
14 answers

Calculate days between two Dates in Java 8

I know there are lots of questions on SO about how to get Dates in Java, but I want an example using new Java 8 Date API. I also know about the JodaTime library, but I want a method without relying on external libraries. The function needs to be…
Marcos
  • 4,827
  • 3
  • 20
  • 28
252
votes
11 answers

momentJS date string add 5 days

i have a start date string "20.03.2014" and i want to add 5 days to this with moment.js but i don't get the new date "25.03.2014" in the alert window. here my javascript Code: startdate = "20.03.2014"; var new_date = moment(startdate,…
Dave
  • 2,815
  • 5
  • 19
  • 22
60
votes
11 answers

Increase days to php current Date()

How do I add a certain number of days to the current date in PHP? I already got the current date with: $today = date('y:m:d'); Just need to add x number of days to it
Anomynous
39
votes
5 answers

How to Subtract Days in MySQL

How can I subtract time in MySQL? For example, today is 16 March; I want to subtract 15 days to reach 1 March. Are there any methods that can be used to subtract 15 days from the current date?
Steven Spielberg
24
votes
10 answers

Algorithm to add or subtract days from a date?

I'm trying to write a Date class in an attempt to learn C++. I'm trying to find an algorithm to add or subtract days to a date, where Day starts from 1 and Month starts from 1. It's proving to be very complex, and google doesn't turn up much, Does…
bcoughlan
  • 25,987
  • 18
  • 90
  • 141
23
votes
7 answers

How can I calculate the number of days between two dates in Perl?

I want to calculate (using the default Perl installation only) the number of days between two dates. The format of both the dates are like so 04-MAY-09. (DD-MMM-YY) I couldn't find any tutorials that discussed that date format. Should I be building…
Perlisasinger
22
votes
4 answers

How can I compare two dates, return a number of days

how can I compare two dates return number of days. Ex: Missing X days of the Cup. look my code. NSDateFormatter *df = [[NSDateFormatter alloc]init]; [df setDateFormat:@"d MMMM,yyyy"]; NSDate *date1 = [df dateFromString:@"11-05-2010"]; …
Dans
  • 231
  • 2
  • 3
19
votes
4 answers

How to calculate when one's 10000 day after his or her birthday will be

I am wondering how to solve this problem with basic Python (no libraries to be used): How can I calculate when one's 10000 day after their birthday will be (/would be)? For instance, given Monday 19/05/2008, the desired day is Friday 05/10/2035…
Dimitris
  • 569
  • 3
  • 14
18
votes
4 answers

django days-of-week representation in model

I have this "Jobs Server" model that i'm building. I want to include a field that will save which days of the week this job will run on. Ultimately in the UI, i would like the user to be able to have a series of check boxes(one for each day) that…
nnachefski
  • 1,552
  • 2
  • 18
  • 29
18
votes
2 answers

How can I get the names of days of week in JodaTime

I've a problem to calculate an entire name list of days of week, using JodaTime. Pratically, I would like to see a similar output based on Locale: 1 day: Sunday 2 day: Monday 3 day: Tuesday 4 day: Wednesday 5 day: Thursday 6 day: Friday 7 day:…
user3449772
  • 749
  • 1
  • 14
  • 27
16
votes
1 answer

How to add ten days to existing date column in Pyspark

I have a dataframe in Pyspark with a date column called "report_date". I want to create a new column called "report_date_10" that is 10 days added to the original report_date column. Below is the code I tried: df_dc["report_date_10"] =…
PineNuts0
  • 4,740
  • 21
  • 67
  • 112
16
votes
1 answer

Javascript Epoch Time In Days

I need the epoch time in days. I've seen posts on how to translate it to date but none in days. I'm pretty bad with epoch time...how could I get this?
dman
  • 10,406
  • 18
  • 102
  • 201
16
votes
6 answers

JavaScript format number to day with always 3 digits

Possible Duplicate: How can I create a Zerofilled value using JavaScript? I have to output a day number that must always have 3 digits. Instead of 3 it must write 003, instead of 12 it must write 012. If it is greater than 100 output it without…
ali
  • 10,927
  • 20
  • 89
  • 138
12
votes
9 answers

Most efficient way to get the dates for the past 7 days?

I've got two functions which I can use to get the dates of the past 7 days and formats the into a particular format but it's pretty slow, does anybody know of a better way maybe using a loop or something similar? function formatDate(date){ var…
user2236497
  • 343
  • 3
  • 5
  • 12
9
votes
13 answers

Get number of weekdays in a given month

I want to calculate the number of weekdays days in a give month and year. Weekdays means monday to friday. How do i do it ?
Hacker
  • 7,798
  • 19
  • 84
  • 154
1
2 3
36 37