datetime

Using date functions in android application?

Hi there, I am displaying some event data based on the todays event and a list of events in a week. Currently I am displaying all the events in form of list from the file, As the file contains out dated events as well but I want to display on the basis of today's date events and a week events then week after. In short I want to restrict...

Unit Testing: DateTime.Now

I have some unit tests that expects the 'current time' to be different than DateTime.Now and I don't want to change the computer's time, obviously. What's the best strategy to achieve this? Thanks ...

Filtering by date with DataTable.RowFilter while ignoring time

How do I filter for records on a DataTable which are on a certain date? I've tried plain [datecol] = #11 March 2010# and CONVERT([datecol],'System.DateTime') = #11 March 2010#. With no luck. MSDN: RowFilter Expression Syntax Solution [datecol] >= #11 March 2010 00:00# AND [datecol] <= #11 March 2010 23:59:59# ...

Linq 2 Sql DateTime format to string yyyy-MM-dd

Basically, i need the equivalent of T-SQL CONVERT(NVARCHAR(10), datevalue, 126) I've tried: from t in ctx.table select t.Date.ToString("yyyy-MM-dd") but it throws not supported exception from t in ctx.table select "" + t.Date.Year + "-" + t.Date.Month + "-" + t.Date.Day but i don't think it's an usable solution, because i might need t...

datetime command line argument in python 2.4

I want to pass a datetime value into my python script on the command line. My first idea was to use optparse and pass the value in as a string, then use datetime.strptime to convert it to a datetime. This works fine on my machine (python 2.6), but I also need to run this script on machines that are running python 2.4, which doesn't have ...

Convert a time to specified time zone using C#?

I'm working on an application in C# with .Net 3.5. I have time zone value of the User is stored in DB with this format (-05:00,1), where -5.00 represents EST time zone value and the 1 indicates that this time zone follows daylight saving (if 0 not a daylight saving zone). Now I want to convert any date time value into this timezone val...

DateJS parsing mystery

I'm using DateJS to parse user-inputted dates, and getting some strange results. Date.parse("15 Jan 2010") returns Fri Jan 15 00:00:00 EST 2010 (right) Date.parse("15-Apr-2010") returns Thu Apr 15 00:00:00 EDT 2010 (right) Date.parse("15 Apr 2010") returns Thu Apr 1 00:00:00 EDT 2010 (wrong) As far as I can tell, the d MMM yyyy input...

Setting time to 23:59:59

I need to compare a date range and am missing rows who's date is the upper comparison date but the time is higher than midnight. Is there a way to set the upper comparison's time to 23:59:59? ...

Win32: GetDateFormat and GetTimeFormat exist. GetDateTimeFormat?

i know Win32 has the Nls function GetDateFormat, e.g.: GetDateFormat(…, …, …, "dddd','MM','y", …, …); and it has GetTimeFormat, e.g.: GetTimeFormat(…, …, …, "tt ss':'hh':'mm", …, …); But there a way to format both at once, e.g.: GetDateTimeFormat(…, …, …, "tt dddd' - 'ss':'y';'hh':'mm MM", …, …); Note: The format string is inten...

Coercing Json Serializer into producing a particular datetime format (yyyy-mm-ddThh:mm:ss.msmsmsZ)

MyClass theSession = new MyClass() { accountId = 12345, timeStamp = DateTime.Now, userType = "theUserType" }; System.Web.Script.Serialization.JavaScriptSerializer Json = new System.Web.Script.Serialization.JavaScriptSerializer(); Response...

Microsoft Integration Server Error Saving data. Problem with date data type.

Im runing a SISS that read several txt with some data, the first 50 files went fine, but, when I get to december data I get this error: There was an error with input column "fecha" (1206) on input "OLE DB Destination Input" (79). The column status returned was: "The value could not be converted because of a potential loss of data.". T...

Get Template::Plugin::Date to accept MySQL dates as well as datetimes

I'm using the date plugin for Template::Toolkit (Template::Plugin::Date), it works well with datetimes (yyyy-mm-dd hh:mm:ss) pulled straight out of MySQL, but it will not work with dates (yyyy-mm-dd). What's the simplest way to get date.format to accept dates (without modifying the sql query)? Thanks. ...

MYSQL - datetime to seconds

Hello, I wasn't able to find out (googling, reading mysql reference manual) how to get value of DATETIME in seconds in MySQL. I dont mean to extract seconds from datetime, but to convert it into seconds. Thanx ...

Given a Date "03/13/2010", using that in a MYSQL Where Clause?

I would like to pass a MYSQL query via Coldfusion the following date: 03/13/2010 So the query filters against it like so: SELECT * FROM myTable WHERE dateAdded before or on 03/13/2010 I'd also like to be able to take 2 dates as ranges, from: 01/11/2000, to: 03/13/2010 SELECT * FROMT myTable WHERE dateAdded is ON or Between 01/11/2000...

Evaluating points in time by months, but without referencing years in Rails

FYI, There is some overlap in the initial description of this question with a question I asked yesterday, but the question is different. My app has users who have seasonal products. When a user selects a product, we allow him to also select the product's season. We accomplish this by letting him select a start date and an end date for...

Can UIDatePicker's minimumDate and maximumDate include time?

Need a UIDatePicker with specific maximum and minimum dates and times. Currently NSDatePicker.minimumDate and .maximumDate appear to only consider the date. What's the proper way to handle this? ...

Filtering a PHP array containing dates into a yearly summary

I'm looking at a way to create a summary of transactions within a certain month based on the contents of a PHP array. Intended outcome (excusing layout): ------------------------------------------- | December 2009 | 12 | | January 2010 | 02 | | February 2010 | 47 | | Mar...

Calculating Hebrew date in Python

I'd like to calculate Hebrew dates (primarily the current Hebrew date) in Python. Which library is mature, easy to use, and documented? I note these. There may be others. Python Date Utilities Library as discussed here Calendrical libhdate Python bindings This informal code listing. ...

How to make strtotime parse dates in Australian (i.e. UK) format: dd/mm/yyyy?

I can't beleive I've never come across this one before. Basically, I'm parsing the text in human-created text documents and one of the fields I need to parse is a date and time. Because I'm in Australia, dates are formatted like dd/mm/yyyy but strtotime only wants to parse it as a US formatted date. Also, exploding by / isn't going to w...

Is there an easier way to get start of current day time than this?

I basically want to get zero or beginning hour for currrent day. def today = Calendar.instance today.set(Calendar.HOUR_OF_DAY, 0) today.set(Calendar.MINUTE, 0) today.set(Calendar.SECOND, 0) println today // Mon Mar 15 00:00:00 SGT 2010 ...