I have the following situation:
I have a certain function that runs a loop and does stuff, and error conditions may make it exit that loop.
I want to be able to check whether the loop is still running or not.
For this, i'm doing, for each loop run:
LastTimeIDidTheLoop = new Date();
And in another function, which runs through SetInte...
I want to convert user-submitted date format (mm/dd/yyyy) to a MySQL date format (YYYY-mm-dd). Submission is via a simple PHP form direc tto MySQL database.
...
I have a MySQL query structured as follows:
SELECT time(c.start_time),
time(c.end_time),
time(c.end_time) - time(c.start_time) as 'opening_hours'
FROM my_shop c;
The data in start and end time is 1970-01-01 07:00:00 and 1970-01-01 19:00:00 respectively.
On my local machine this this query returns:
| 07:00:00 | 19:00:0...
If I wanted to work using dates and time going millions of years into the past/future how would I do it in C/C++/C#?
For example say I was working on an algorithm to see if a comet was going to hit the earth? Are there commercial or open source libraries that do this?
Most DateTime values only work for a few years. Unixes will run out...
What is the difference between the two functions "IsSameDay" and "SameDate" in the Delphi DateUtils library?
...
Hello. I hope someone could help me on this.
I want to add a month to a database date, but I want to prevent two jumping over month on those days at the end.
For instance I may have:
Jan 31 2009
And I want to get
Feb 28 2009
and not
March 2 2009
Next date would be
March 28 2009
Jun 28 2009
etc.
Is there a function that...
With the Cocoa framework how can I parse @"2008-12-29T00:27:42-08:00" into an NSDate object? The standard -dateWithString: doesn't like it.
...
Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?
DateTime.DaysInAWeek // Something like this???
Of course I can define my own, but I'd rather not if it's somewhere in there already.
Update:
I am looking for this because I need to allow the user to select a week (by date, rather than wee...
Open up a Rails console and enter this:
2.weeks.ago.between? 2.weeks.ago, 1.week.ago
Did it give you true or false? No really, try it a few more times and it will give you different answers.
Now, I'm thinking that because we're comparing 2.weeks.ago with 2.weeks.ago, the time between evaluating the two statements is causing this beha...
There are several filter methods for dates (year,month,day). If I want to match a full date, say 2008/10/18, is there a better way than this:
Entry.objects.filter(pub_date__year=2008).filter(pub_date__month=10).filter(pub_date__day=18)
...
What are some Date (& Time) format best practices when wanting to adhere to localization in a new application.
For example, what format do you use to write dates to the database.
How do you display the following to the user using their own locale settings once the date has been obtained from the database.
ShortDate
LongDate
DateTime
...
I'm trying to parse a date/time string using DateTime.ParseExact. It works everywhere, except on one machine - it just will not parse on that machine. The question is: Why? What could be different on that machine so that it will cause this behaviour?
Here are some things that I've already looked at:
The CultureInfo is passed to DateTi...
I am curious what would be the best way to handle an ambiguous date string in any given language. When pre-validating your user input isn't an option, how should MM/dd/YYYY dates be parsed?
How would you parse the following ambiguous date and for what reason (statistical, cultural, etc)?
'1111900' as Jan 11, 1900 [M/dd/YYYY] or Nov 1,...
I have two dates (parsed using str2time). How can I tell if one is after the other?
...
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.
Solutions can be in C/C++, python, perl, bash, etc...
...
Using standard mysql functions is there a way to write a query that will return a list of days between two dates.
eg given 2009-01-01 and 2009-01-13 it would return a one column table with the values:
2009-01-01
2009-01-02
2009-01-03
2009-01-04
2009-01-05
2009-01-06
2009-01-07
2009-01-08
2009-01-09
2009-01-10
2009-01-11
2009-01-12...
I am setting the locale of my .net application via:
string userLocale = Web.Helpers.LocaleHelpers.GetBestRFC3066Locale(this.Context.Request.UserLanguages);
if (userLocale != String.Empty)
{
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCul...
i try to write any code about days:
function xyz("13.02.2009")
{
return value= 6;
}
function xyz("12.02.2009")
{
return value= 5;
}
function xyz("14.02.2009")
{
return value= 7;
}
but how?
tihs method is good but i need C# times specific codes(like timespan...)
DayOfWeek day = DateTime.ParseExact("13.02.20...
I have a database table. It has several hundred entries and each entry is timestamped. I'm looking to only output each day and not have it duplicate any days.
Data:
2009-02-04 06:20:27
2009-02-04 06:20:27
2009-02-05 06:20:27
2009-02-07 06:20:27
2009-02-07 06:20:27
2009-02-07 06:20:27
Output should only be (time is irrelevant):
20...
I'm working on a Web app where users need to input a date and time. I've used this calendar widget before and it works fine:
http://www.dynarch.com/projects/calendar/
However, it hasn't been updated since 2005. I'm wondering if anyone knows of a better one.
The calendar in jQuery UI doesn't handle times. Only dates. I need something t...