datetime

Problem to represent midnight for 01 May 1921 by java.util.Date class

I want to represent midnight by java.util.Date class. To check this I output this value and obtain unexpected result. The code follows: Calendar calendar = new GregorianCalendar(1921, 4, 1, 0, 0); Date date2 = calendar.getTime(); System.out.println(date2); I obtain the following output: Sun May 01 00:20:08 EET 1921 But I expect to...

How to parse four digit year only (with Joda Time)?

Is there a way to force Joda time to parse dates only when they contain four digit years? For example: 2009-11-11 - should parse 09-11-11 - should not parse Tried the following code: DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder(); DateTimeFormatter formatter = builder.appendYear(4, 4).appendLiteral('-').appendMont...

C# Mark Properties in foreign assemblies as obsolete?

I'd like to mark some specific properties in a foreign assembly that i'm referencing as obsolete. Is it possible to do so? Or is it possible to get a compiler warning/error if a specific property is used? We have our own DateTime class for specific tests and i want everyone to use them and not the normal DateTime.Now and DateTime.Today ...

C#: How can DateTime.Now be just an attribute?

Hi I'm trying to understand how the implementation of the Now attribute in DateTime works. My background is mainly Python and Haskell so I can't by my life understand how the Now attribute can "return" different values depending on when you use it. My intuition says that Now should really be a function which does some low-level magic f...

convert ticks to time_t or Filetime()

how do i convert ticks to time_t or filetime(). Please suggest thanks ...

PyDateTime_IMPORT macro not initializing PyDateTimeAPI variable

I'm using the Python C API on Windows using Visual Studio 2008. When I attempt to use the PyDate_Check macro, and other related macros, they cause an access violation because the static variable PyDateTimeAPI is null. This variable is initialized using the PyDateTime_IMPORT macro which needs calling before using any date time macros. I d...

Why does this date parse not work in C# .net 1.1?

private bool ValidDateCheck(){ bool _isValid = true; try{ DateTime.Parse("07/&*/2009"); DateTime d = Convert.ToDateTime("07/&*/2009"); } catch{ _isValid = false; } return _isValid; } How does the above code not throw an exception? ...

How can I know the day name from a selected date?

Hello Im using C# 3.5, I have this : Datetime.Now(); or 23/10/2009 I want this : Friday for local datetime (GMT-5) and using gregorian calendar. Thanks ...

How to set default datetime values in an XSD element

I am currently stuck at this point where I need to set an xsd element's default attribute to have a valid current date as default. I looked around (googled) but did not find anything convincing. I need to do this in declaratively. <xs:element name="UpdatedDate" type="xs: dateTime" msdata:Caption="Updat...

Calculate the number of business days between two dates?

In C#, how can I calculate the number of business (or weekdays) days between two dates? Thanks! ...

strptime returning unexpected results

I'm still very new to C and trying to learn how to use strptime to see if it will work for part of a project, but I can't even get what seems like a very basic example working right... int main() { struct tm *t; t = (struct tm *) malloc(sizeof(struct tm)); memset(t, 0, sizeof(t)); if (strptime("12-2009", "%m-%Y", t) != ...

Which ISO8601 date/time incl. timezone format to use for maximum success across languages?

The ISO8601 format for date/time representations supports many variations of format to express the same information. I know that not all languages have libraries that support the range of the standard - for example, I've had problems parsing the different possible formats of the timezone using Java's SimpleDateFormat API. Given the cho...

date range comparison

I am looking for a way to have a date/time method where I have multiple drop downs Month/ Day / Year -- Hour / am/pm Month/ Day / Year -- Hour / am/pm I am looking for maybe a jquery plugin that will take the first row and on update change the bottom row in a range of time. So if I picked 11pm on the first row, it would change "day"...

SQL Query including time calculation

Hi, Had a good search here but can't see anything that gets my mind in gear for this one. Basically I have a table call Diaries, this contains fields such as StartTime EndTime, I need to do a calculation that works out the difference in minutes between StartTime and EndTime. then for each row that fits that day I need to add up the res...

What's the most efficient way get the first day of the current month?

With ruby I'm trying to get format a date as such: 2009-10-01 Where I take the current date (2009-10-26) and then change the day to "01". I know of ways to do this, but was curious what the shortest way is, code wise, to pull this off. ...

Excel formula for time comparision

while writing an formula for data in a excel cell if an excel cell contains an integer we can use the statement if (cell.value > 100 ) but when the excel cell contains a time duration in the format min:sec and we have to compare value greater than 3 minutes duration how to write the statement. if (cell.value > 03:00 ) is this stateme...

How to convert into date format?

Using Access 2003 Date Column datatype is text Table1 Date 20090528 20090529 20090530 20090502 20090504 Expected Output 28-May-2009 29-May-2009 30-May-2009 02-May-2009 04-May-2009 ..., How to make a query for the Expected Output Date format? ...

Whither NSDate dateByAddingTimeInterval on iPhone OS?

Greetings! I must be seeing things. Look at this excerpt from the iPhone OS reference library: addTimeInterval: Returns a new NSDate object that is set to a given number of seconds relative to the receiver. (Deprecated. This method has been replaced by dateByAddingTimeInterval:.) However, it is nowhere to be found in the docs...

How to control ASP.NET MVC Route generation?

I have a route like routes.MapRoute( "Reports", // Route name. "reports/{controller}/{action}/{id}/{start}/{end}", // URL with parameters. new { controller = "Home", action = "Index", id = "", start="", end="" } // Parameter defaults. ); where start ...

Indexing performance null vs dummy data

I have a table with a InTime and an OutTime column. Normally when I insert data into this table I set the InTime to a DateTime and the OutTime to null. When the data is removed a OutTime value is set. When I’m getting data out for a particular time I use something like: where InTime < sometime and OutTime is > sometime or OutTime is n...