datetime

Problem with simple select query to find dates in SQL Server

I use simple query to get dates of contract for a person: SELECT [KlienciUmowyDataPoczatkowa], IsNULL([KlienciUmowyDataKoncowa], GETDATE()) AS 'KlienciUmowyDataKoncowa' FROM [BazaZarzadzanie].[dbo].[KlienciPortfeleUmowy] WHERE [PortfelID] = 3 This is what I get: KlienciUmowyDataPoczatkowa KlienciUmowyDataKoncowa 2005-11-...

Finding largest time interval between list of dates

I have a table of items, each with a timestamp connected to it. I want to find the largest interval between any pair of consecutive items. Is this possible with a query only? UPDATE: Let me see if I can make this a little less confusing. What I want to do is compare each items timestamp to the item before and after it, to find out how...

Adding up time durations in Python

I would like to add up a series of splits in Python. The times begin as strings like "00:08:30.291". I can't seem to find the right way to use the Python objects or API to make this convenient/elegant. It seems that the time object doesn't use microseconds, so I'm using datetime's strptime to parse the strings, successfully. But then dat...

Storing annually repeatable values in a MySQL database

I've been hammering my head against my desk for the past few days on this, and so I turn to you, Stack Overflow. The software I'm working on has time-sensitive data. The usual solution for this is effective and expiration dates. EFF_DT XPIR_DT VALUE 2000-05-01 2000-10-31 100 2000-11-01 (null) 90 This would be easy. ...

Parsing javascript date string to timestamp. the tz info is in the date!

I have to parse a javascript date string to a timestamp. If the date string has the TZ info, why do I have to supply a TZ object in the DateTime constructor and again with setTimezone()? Is there an easier way to do this that is aware of the TZ info in the date? $s = 'Thu Mar 11 2010 13:00:00 GMT-0500 (EST)'; $dt_obj = new DateTime($s, ...

Get Last Monday - Sunday's dates: Is there a better way?

Hi, I'm preparing a query for mySQL to grab record from the previous week, but I have to treat weeks as Monday - Sunday. I had originally done this: WHERE YEARWEEK(contactDate) = YEARWEEK(DATE_SUB(CURDATE(),INTERVAL 7 DAY)) to discover that mySQL treats weeks as Sunday - Monday. So instead I'm parsing getting the begin & end dates in...

how to convert a timedelta object into a datetime object

What is the proper way to convert a timedelta object into a datetime object? I immediately think of something like datetime(0)+deltaObj but that's not very nice... isn't there a toDateTime() function or something of the sort? ...

How to programatically convert a time from one timezone to another in C?

The info pages for the GNU date command contains this example: For example, with the GNU date command you can answer the question "What time is it in New York when a Paris clock shows 6:30am on October 31, 2004?" by using a date beginning with `TZ="Europe/Paris"' as shown in the following shell transcript: $ export TZ="...

Does anyone know how to get the local date and time from Android 2.1 device?

Does anyone know know how to programatically get the local date and time of the Android device? With that local date and time, does anyone know how to convert that to milliseconds from 1970 in UTC time? ...

Check for datetime

Hay.. I am facing a problem, I am getting a string 'strData' which contain user search value. I am splitting that string by space and putting in array. how can i check that the string which i getting from array is date or not? if is it date type so i will need to convert it in datetime. I am using MySql as a database. I am doing like th...

jQuery UI datepicker not showing week numbers

My jquery UI datepicker is not showing week numbers, even with the showWeek:true option set. Here is my code: <script type='text/javascript'> $(document).ready(function(){ $('#startDate').datepicker({ changeMonth: true, changeYear:true, dateFormat: 'd-M-yy', firstDay: 1, showButtonPanel: true, ...

Using Alphabetic Characters in SimpleDateFormat Pattern String

Is it possible to include an alphabetic character in a SimpleDateFormat Pattern String? I am trying to create a format string where the letter 'T' is included before the time for example: 2003-11-15*T*09:30:47-05:00. I am currently using yyyy-MM-ddhh:mm:ssZ as the pattern string. If I change it to yyyy-MM-ddThh:mm:ssZ it will throw a...

Converting time to Military

Maybe I'm seeing things.. In an attempt to turn a date with a format of "mm/dd/yyyy hh:mm:ss PM" into military time, the following replacement of a row value does not seem to take. Even though I am sure I have done this before (with column values other than dates). Is there some reason that row["adate"] would not accept a value assigne...

Regional problems with C# and SQL Database

Why would dateTimePicker.Value.Date.ToShortDateString(); act differently on Windows 7 x64 PL, Windows Vista x32 PL and Windows XP PL with to my knowledge exact regional settings. I've found it out the hard way that i was doing this conversion prior to entering it to DB. It was working fine on Windows 7 (my development machine), colleag...

.NET webservice datetime.now - time zone

I need to return server time from a webservice. I've got the following code: <WebMethod()> _ Public Function GetDate() As DateTime Return DateTime.Now End Function The code always returns time based on timezone of the connected client (if I change the time zone, the webservice returns updated time, instead of local server tim...

Mysql timestamp timezone wierdness

So I want to grab records from a table based on the day of the month the record was created. This information is stored in a unix timestamp. During testing I created new test records and through in some timestamps for specific day and times that I had converted to timestamps using an online converter. I used... 01/29/2010-02:00:00 R...

MM/dd/yyyy format

I have the following: PMRCutoffDate.Value = ReportCalc.Cutoff_Date.ToString("MM/dd/yyyy"); PMRDate.Value = DateTime.Now.ToString("MM/dd/yyyy"); i want dates to show up as: 03/05/2010, not 3/5/2010 or 03/5/2010 or 3/05/2010 However, my program STILL shows the date incorrectly (3/10/2010). Any ideas on what's wrong? ...

How to prevent out-of-range datetime value error?

I am passing an ad-hoc Insert statement from c# application to the sql server 2000/2005. Sometimes, if machine (where sql server is installed) datetime format is different than what I am passing in, it is throwing an error. e.g. : In Insert statement I am passing '2010-03-10 00:00:00-05:00' this but machine regional date setting is dif...

Datetime picker in iphone

I have one issue with Datetime Picker In my firstview i have button.If i click that button it should open DateTime Picker in the second view. After selecting the datetime it should show datetime in the firstview text field. Please help in this issue. ...

DateTime comparing question

I have to compare three dates in linq query (datetime a < datetime b < datetime c), but just properties month and day. How can i do it? ...