datetime

Date Popup module - I want a Time Popup as well

I've got a field in a form (custom content type built using CCK) configured as a date and time. I have the Date Popup module installed. My field shows up as two fields, one for the date and one for the time. When users click in the date field, the JQuery calendar pops up and all is fine. But nothing happens when they click in the time ...

C# - Find if current time falls in a time range

Using .NET 3.5 I want to determine if the current time falls in a time range. So far I have the currentime: DateTime currentTime = new DateTime(); currentTime.TimeOfDay; I'm blanking out on how to get the time range converted and compared. Would this work? if (Convert.ToDateTime("11:59") <= currentTime.TimeOfDay && Convert.ToD...

T-SQL code to get a DateTime contain only Month and Year from any DateTime

Given a table Event containing a field called EventTime of type DateTime and that the value will contain both date and time elements, I need create a summary query which counts the number of events in each month. The resulting type of the Group By field must also be Date Time with a 0 time element and set to 1st day of the month. This ...

How to convert DateTime string into a Format string

With .NET, I have "Thursday, April 10, 2008 1:30:00 PM" and I want "dddd, dd MMMM, yyyy h:m:s t", "6:09:01 PM" and want ""hh:mm:ss tt", "Fri 29 Aug" and want "ddd d MMM", and so on. It seems I should be able to use DateTimeFormatInfo in some way. I figured I can format the date with each pattern returned by GetAllDateTimePatterns, and ...

.NET Function to determine first, last day, etc.

Does anyone know of a good piece of C# code or assembly that supports the following: Find the 1st Tuesday of June 2012 Find the last Friday of March 2008 Find every Saturday in January 2013 Find the 3rd Friday in July 2009 Find every Saturday over the next 3 months Find every day in March 2018 The results should come back as...

Cleanest and most Pythonic way to get tomorrow's date?

What is the cleanest and most Pythonic way to get tomorrow's date? There must be a better way than to add one to the day, handle days at the end of the month, etc. ...

UTC within Site

Hi, I am working on a website that will only be available via the intranet but is a website that is Australia wide ONLY. The thing is, I have been asked to look into making the site UTC and was wondering how I could go about displaying a clock or determing which timezone the site in running in and so perhaps display a clock on the home...

Javascript Date.UTC() function is off by a month?

I was playing around with Javascript creating a simple countdown clock when I came across this strange behavior: var a = new Date(), now = a.getTime(), then = Date.UTC(2009,10,31), diff = then -now , daysleft = parseInt(diff/(24*60*60*1000)); console.log(daysleft ); The daysleft is off by 30 days. What is wrong with this code? Edit...

conversion from string yyyyMMdd to type integer is not valid

I have a dataset containing a datatable, and I enumerate all rows in that datatable. When trying to format a column in that row, I run into an exception. (Part of) the code is: For Each dr As DataRow In ds.Tables("records").Rows file = dr("timestamp").ToString("yyyyMMdd") & "~.wav" Next This results in the following error message:...

DateTime, .AddSeconds() not working?

I've been scratching my head over this one for a couple hours now, I've drafted in co-workers and we are all lost. This could be a case of too much coffee from the new espresso machine, or the fact it's Friday... We're not sure! I have the following method: private void calcuateEstimatedExecutionTimesForDueJobs(List<TestJob> dueJobs)...

Need help with a MySQL/PHP query involving date ranges

Essentially I need to retrieve some account information from the dbase table where they have a client of the client that has been passed via GET, and the account placement date (dateplaced) is between the start and end dates passed from calendar fields again via GET. The query below returns no rows. I have verified that the SELECT and F...

Why isn't AddMonths() working on my DateTime? (see code)

Controller: DateTime startDate = DateTime.Now; ViewData["now"] = startDate.ToString(); ViewData["interval"] = interval.ToString(); startDate.AddMonths(interval); ViewData["later"] = startDate.ToString(); View: Now: <%=ViewData["now"] %><br /> Later: <%=ViewData["later"] %><br /> Interval: ...

datetime string issue in c#

Suppose I have following code to convert datetime to string: DateTime dt; //... string ds = dt.ToString("dd/MM/yyyy hh:mm") If the dt is 15/02/2009 08:22, I want to the string is 15/02/2009 08:22AM If the dt is 15/02/2009 20:22, I want to the string is 15/02/2009 08:22PM How to implement it? ...

How to set the base time for DateTime in IIS (ASP) for compatibility mode?

We have updated our servers with Windows 2008 Server, but we are still using SQL Server 2005 in our production software. The problem comes in one part of the system where we store times as datetimes. Since ever, storing a time in a datetime column stored the base date as the date. It is 1900-01-01 in SQL Server 2005. Back then, IIS under...

C# using minTime.ToUniversalTime is an hour out on a clients computer

I don't know a great deal about this subject so forgive my daft question, I have a datagrid that shows the date and time a change was made to the database, it works fine on my PC but on my clients the time is +1 hour. Is this because I have used .ToUniversalTime instead of .ToLocalTime? Thanks for any help. Update: I've just run the pro...

How to grab items from a DB by date

This is my script: $spending_period = time() - (30 * 24 * 60 * 60); $spending_period = date('Y-m-d', $spending_period); $monthly_income_query="SELECT amount FROM budget_items WHERE (date_code >= '$spending_period') && (type=='Income') ORDER BY date_code DESC"; $monthly_income_result=mysql_query($monthly_income_query); while($monthly_inc...

DateTime Format in MS Access

i developed a module and store data into an MS Access Database(mdb). The one Field uses DateTime Name(Date_of_Installation) for reference. The records stored fine. when I retrieve the Record using OleDBDataAdaptor to fill an DataSet for problem of datetime is changing format in Database to how can change the datetime format in DB. Exampl...

Only showing year in django admin, a YearField instead of DateField?

I've got a model where I need to store birth year. I'm using django admin. The person using this will be filling out loads of people every day, and DateField() shows too much (not interested in the day/month). This is a mockup model showing how it is now: class Person(models.Model): name = models.CharField(max_length=256) born = mo...

Get interval seconds between two datetime in PHP?

2009-10-05 18:11:08 2009-10-05 18:07:13 This should generate 235,how to do it ? ...

How can I select the first day of a month in SQL ?

I just need to select the first day of the month of a given datetime variable. I know it's quite easy to do using this kind of code : select CAST(CAST(YEAR(@mydate) AS VARCHAR(4)) + '/' + CAST(MONTH(@mydate) AS VARCHAR(2)) + '/01' AS DATETIME) but this is not very elegant, and probably not very fast either. Is there a 'better way t...