datetime

SQL Server 2008 VarChar To DateTime

I have a table where unfortunately a number of dates are stored as strings. I have a number of reports that cast them to datetimes and filter by them. This was working fine until today when all of a sudden i'm getting this error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value." The dat...

Save data with LINQ

I've create object with data type: DateTime But I want save as char data type in sql server ex: assign value to obj property: MyDateTime=DateTime.Now; //when use to string method result: MM/dd/yyyy hh:mm:ss //save to db MyDateTime column with data type char(12) we will save: MM/dd/yyyy How can I save it. I try use assign converter attr...

Android - date format conversion

Hello, I am having a date/time value as 2010-07-26T11:37:52Z , now i wants date in 26-jul-2010 (dd-mon-yyyy) format, how do i do it? ...

best way to store datetime in to mongodb?

I've seen some using strings, int timestamps and some mongo datetime objects. ...

Converting a PHP anonymous function to non-anonymous

Hi, I asked a related question before I lost my login id - http://stackoverflow.com/questions/3723748/php-version-5-2-14-parse-error-syntax-error-unexpected-t-function-expecting - but this is the "entire" problem. I'm having a hard time figuring out how to convert this function (got from somewhere on SO) to work with PHP 5.2.14 (which ...

SQLite - current_timestamp doesn't return the right hour?

In the SQLite IDE SQL window, I've written the instruction to return the the equivalence of .NET DateTime.Now, which is CURRENT_TIMESTAMP. Let's say it is 10:47:00 in local time, that is, GMT -4:00 (on summertime), otherwise it is GMT -5:00. The result of my query: select current_timestamp returns 2010-09-23 14:47:00, regardless of ...

php DateTime timezone for Columbus Ohio

Columbus, Ohio is in EDT timezone but PHP::DateTime uses these php timezones and I cannot seem to find one that gives me correct time. America/New_York is off by an hour because until EDT ends we are +5 not 4. I am confused. For example right now its 11:26AM roughly speaking and I get back 10:26AM. The server has the right time set...

Converting a string in ddMMyyyy format to a DateTime

How do I convert a string in ddMMyyyy format to a DateTime? ...

How to split start/end time columns into discreet chunks with PostgreSQL?

We have some tables, which have a structure like: start, -- datetime end, -- datetime cost -- decimal So, for example, there might be a row like: 01/01/2010 10:08am, 01/01/2010 1:56pm, 135.00 01/01/2010 11:01am, 01/01/2010 3:22pm, 118.00 01/01/2010 06:19pm, 01/02/2010 1:43am, 167.00 Etc... I'd like to get this into a format (with ...

DateTime casting/magic

Is there a nice concise way to write this logic in C#? if ((DateTime.Now >= "8:00 AM") && (DateTime.Now < 5:00 PM)) {// do something} I am making a demo app where I want to make something happen in the work day, but I don't want this code to stand out much (a lot of casting = bad). (Because I want my demo stuff to be easier to see. ...

CakePHP Queries involving DateTime

I'm having some trouble working out how to do comparisons on a datetime field, in the course of a CakePHP query. I want for instance to be able to periodically delete all records from my database that relate to an event that occurred in the past. But I haven't gotten much further than: $this->Item->deleteAll( 'conditions'=>array('da...

How do I convert DateTime object to HTTP format?

I'm using the DateTime Perl module to get the time in a particular timezone. The result of the time is as follows 2010-09-24T02:18:52 How can I convert this to HTTP format before printing? ...

parsing of date/time from string (boost?)

I'm kinda stuck with parsing of date/time strings. Help would be greatly appreciated. Input: strings with date and optional time. Different representations would be nice but necessary. The strings are user-supplied and can be malformed. Examples: - "2004-03-21 12:45:33" (I consider this the default layout) - "2004/03/21 12:45:33" (o...

Creating a new DateTime object in PHP does not work

Hi, I have the following piece of code. I've recorded the output as well: function convertGeneralAvailabilityTime($date,$from_timezone,$from_timebegin, $from_time$ { echo "$date,$from_timezone,$from_timebegin, $from_timeend, $to_timezone"; // 2010-09-19,America/New_York,07:45:00, 08:00:00, America/Los_Angeles $tz1 = new DateTimezone(...

How to change time part of a datetime value with doctrine?

I need to change the time part of a datetime in a database. What I got is in the database: '2010-01-01 01:00:00' I need to update this to '2010-01-01 03:00:00' Only thing I have is '03:00:00' As I'm using doctrine I could iterate through all objects but this would decrease the perfomance. So what I tried was: $q = Doctrine_Query::crea...

Determine how to calculate split weeks in SQL Server

Im not quite sure what the term is, I have been calling it "Split Weeks" but here is what I need to find out. Given: User will input @StartDate and @EndDate col_week_end_date will always end on a Saturday, and is a DateTime column. I want to cycle through either multiple or a single month(s) and sum col_payment_amt Using the month o...

How can I convert this date in Java?

I want to convert: 2010-03-15T16:34:46Z into something like "5 hours ago" How can I do this in Java? ...

Convert UTC dates to local time in PHP

Hi, I'm storing the UTC dates into the DB using: $utc = gmdate("M d Y h:i:s A"); and then I want to convert the saved UTC date to the client's local time. How can I do that? Thanks ...

JavaScript countdown to MySQL datetime format

I have a date that comes from a MySQL database in the datetime format, something like 2010-09-24 11:30:12. And I need a way to show a countdown of hours:mins to that date. I'm not very familiar with dates in JavaScript so any help would be apreciated. Thanks. ...

How can I convert this string to a standard date in java?

Earlier I posted the following question: http://stackoverflow.com/questions/3791984/how-can-i-convert-this-date-in-java But now I would like to know how I can convert this string into a date/time. 2010-03-15T16:34:46Z For example: 03/15/10 UPDATED: String pattern = "MM/dd/yy 'at' HH:mm"; Date date = new Date(); ...