datetime

boost local_date_time math wrong?

I'm using Boost's datetime library in my project. I was very happy when I discovered that it has time duration types for hours, days, months, years, etc, and they change their value based on what you're adding them to (i.e. adding 1 month advances the month part of the date, it doesn't just add 30 days or somesuch). I thought this prop...

Convert string to datetime to year and month SQL

Hi How do i get the year(2009) and month(12) from the string datetime, following give me correct full date but wrong year (1905-07-03 00:00:00.000) and month (1900-01-13 00:00:00.000). I have tried changing YYYY to year and MM to month. Declare @date dateTime; Declare @CurrentYear datetime; Declare @CurrentMonth datetime; Select @date ...

MVC.NET milliseconds get lost when using Html.hidden on a DateTime LastUpdated column for version tracking

Question in short: How tot do this in MVC.NET? Question in long version: Im trying to use a DateTime column in a SQL Table for version tracking (this in itself is proposed as a solution to re-attaching a Linq2Sql data class after being passedback by a editview for the table) But now i get 'row not found or changed'-exception. on the ...

Dateformat mismatch in sql server and C# code

I have a problem. I have an application in C# with SQL SERVER 2005 as backend. The problem is in fetching the correct record based on the date. The frontend code is if (string.IsNullOrEmpty(txtFromDate.Text)) SelectCmd.Parameters[0].Value = DBNull.Value; else SelectCmd.Parameters[0].Value = txtFromDate.Text; Now if I ru...

DateTime to RFC-1123 gives inaccurate timezone

If I get the RFC-1123 formatted date of a DateTime object, it gives the current local time, but gives the timezone as GMT (which is inaccurate). DateTime.Now.ToString("r"); returns Fri, 12 Feb 2010 16:23:03 GMT At 4:23 in the afternoon, but my timezone is UTC+10 (plus, we're currently observing daylight saving time). Now, I can get a r...

how to get the same day of next month of a given day in python using datetime

i know using datetime.timedelta i can get the date of some days away form given date daysafter = datetime.date.today() + datetime.timedelta(days=5) but seems no datetime.timedelta(months=1) !Thanks for any help! ...

php date time function

hi , I want to convert this date ( 02-12-2010) mm-dd-yyyy to time format ie to 02-12-2010 0 hours 0 minutes and 0 seconds i have user time and date functions but when i refresh the page its value is changing as per the time. i need that to be fixed also i want to convert this date (01-24-2009) to time format. please help me Tha...

PHP ini date.timezone? Server or client location time zone?

I know this might sound a silly question, but I did not find in PHP documentation somewhere were they state loud and clear this one. I have got a web application. Users of my web appliations are in Europe, but the server running the web appliation is in US. How should I set the date.timezone php ini directive??? I suppose to where th...

Data Annotation Ranges of UK Datetime fields

I want to use Data Annotations to validate DateTime fields, but I'm running into problems. According to documentation on MSDN, the following should do the job [Range(typeof(DateTime), "1/2/2004", "3/4/2004", ErrorMessage = "Value for {0} must be between {1} and {2}")] However, this marks any date I enter as invalid! At first I th...

Convert Between Datetime Formats Using Perl

We're currently using a 3rd party API that provides datetime in the following format: Sat Mar 06 09:00:00 ICST 2010 Fri Feb 19 19:30:00 JDT 2010 Fri Feb 19 19:30:00 PST 2010 However, we want to store these datetime objects in MySQL in a standard datetime field which requires the following format: YYYY-MM-DD HH:MM:SS Right now we're...

better DateTime.Parse out there?

Does anyone know of a library (paid or not) out there that is able to handle more common datetime formats than DateTime.Parse uses? Something that can handle multiple languages and abbreviations for days/months would be really nice. For example: "Sept 1, 2009" does not work with Datetime.Parse. ...

Are there locales or common programs that use YYYY-DD-MM as the date format?

I've often standardized on YYYY-MM-DD as the date format for communicating within a geographically distributed project teams to dispel any ambiguity that might arise from local date formats. Is it likely that I might run into people who are used to seeing dates as YYYY-DD-MM? Are there programs that use this as a date format? ...

Day/Date/Time/Temperature Info bar

Hi All, Thanks for looking at my question. I am looking to have a London information bar on a website. Something that will show the following information: London, England: 9:27PM Friday 12 February 10°C/50°F Can anyone please help? Thanks :) TO LET ALL KNOW, I DO JUST WANT IT FOR LONDON. NO MATTER WHERE YOU ARE VIEWING IT FROM. NO...

How to change 'Timestamp'-column language in MySql?

I have a column which is a Timestamp. It records something like: 2010-02-08 12:10:22 Then I use this in php: $postdate = date( "j F", strtotime( $row['modify_date'] ) ); And it can output something like: 8 February My Q is, how can I change the date-text so it outputs the month name in another language (swedish specifically)? Ex:...

Storing microseconds in MySQL: which workaround?

Hi, we're writing a scientific tool with MySQL support. The problem is, we need microsecond precision for our datetime fields, which MySQL doesn't currently support. I see at least two workarounds here: Using a decimal() column type, with integer part corresponding to seconds since some point in time (I doubt that UNIX epoch will do, ...

Little help with this "date" function

I have this to select a date from a mysql db, and compare it to an array of month-names in swedish language. $monthnames = array("","Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"); $postdate = $monthnames[date("n", strtotime( $row['modify_date'] ))]; //Outputs something lik...

PHP date format question

I'm trying to format some dates in PHP (i'm a Coldfusion programmer, so the syntax is similar, but i'm stuck!). The dates are formatting perfectly into the display I want. However, they all return 1st Jan 1970. Can anyone shed any light on this? For background, I am pulling a date from a datetime column in mySQL. The raw date i'm tryi...

MySQL query for current GMT time

This sounds simple enough but I haven't been able to figure out how to use a simple SELECT statement to return the current time in GMT. I have been trying to use CONVERT_TZ() to convert NOW() to GMT based on the server time zone and the GMT time zone but for some reason it returns NULL when I put in the text time zones. The only way I g...

ASP.net-MVC2 RC2: jQuery 1.4.1 and dateTime evaluation

Im trying to incorporate jQuery plugin FullCalendar into my application. All was going well until i decided to implement the dropping of a calendar event in the calendar. for this i hooked up the following code to the eventDrop eventhandler (jquery / clientside) eventDrop: function( event, dayDelta, minuteDelta, allDay, re...

Select date/time groupings in MySQL grouped by hour

I have a bunch of date data in a mysql table like this: 2010-02-13 1:00:00, "soma data" 2010-02-13 1:25:00, "soma data" 2010-02-13 1:37:00, "soma data" 2010-02-13 2:12:00, "soma data" I want to select a report which shows the data grouped by hour, for example: On Feb 13, during the hour from 1:00 pm to 1:59 pm, there were 3 data poin...