datetime

monkey patching time.time() in python

Hello guys, I've an application where, for testing, I need to replace the time.time() call with a specific timestamp, I've done that in the past using ruby (code available here: http://github.com/zemariamm/Back-to-Future/blob/master/back_to_future.rb ) However I do not know how to do this using Python. Any hints ? Cheers, Ze Maria ...

Custom date time picker for Windows Forms that is locked to GMT time

Using Visual Studio 2008, c#, .net 2.0. I have a Windows Forms client application that contains a scheduling UI section, currently this is housed only in the London office with the standard datetime picker control, the selected time is saved in a UK database (GMT) and a London based server aapplication processes the schedules. There ...

how to get time (hh:mm:ss) from sql query ?

hi i have Database with date field. i see the time like: 1900-01-01 13:38:00.000 how i can see it like: 13:38 ? (i work on sql server 2008) thank's in advance ...

Get Date Strings for draw_calendar() Function

I'm using the David Walsh PHP calendar script and need to format my date arguments like this: draw_calendar(7,2009); I want to get today's Month and Year as well as the next month and the month after that (so current month, plus one, plus one). How can I call the function three times in succession to generate these three calendars only...

Convert System.DateTime to Javascript DateString

I am working on an ASP .net MVC application. I have a System.DateTime? property say creationDate, which gets its value assigned from controller code. In my javascript I have access to this value, and I wanted to display this value in mm/dd/yyyy format in my grid. But I am not sure on how to convert System.Datetime? of c# to a javscript ...

Java Equivalent to .NET's DateTime.Parse?

I'm working on a java class that I will use with Pervasive Data Profiler that needs to check if a Date String will work with .NET's DateTime.Parse. Is there an equivalent class or 3rd party library that can give me this functionality that is very close to .NET's DateTime.Parse? I would need it to be able to handle a broad range of date...

Convert a date string to a Unix timestamp

I have this date "Mon Mar 15 20:51:18 +0000 2010". How do i convert this date into a Unix timestamp? ...

Calculate time from timezones in php

Hai I have the system with employees having different timezones in their profile. I would like to show the date according to their timezones specified. The GMT time zone values are placed in the database. could you guys help me ...

DateTime.MinValue vs new DateTime() in C#

When getting SQL DateTime Resharper suggests to use new DateTime() when value is DBNull.Value. I've always used DateTime.MinValue. Which is the proper way? DateTime varData = sqlQueryResult["Data"] is DateTime ? (DateTime) sqlQueryResult["Data"] : new DateTime(); ...

How do I show the 'blog last updated' time in Wordpress?

I want to show the time of the last blog update at the header of my wordpress blog. It's not the last update time of a post but rather any post or page (i.e. any last update done in the blog) e.g. Format: Now: Tuesday, March 16, 2010 | Last Update: 6:09 PM ET Is there any template tag to accomplish this? ...

count date difference in hours using php and mysql

Hi, How can i find the date difference in hours using php and mysql both. Thanks Avinash ...

Is there a library in Python that can convert user-dates to timestamp?

If the month is: "12" Day is: "05" Year is: "2010" Can this be converted into a timestamp somehow, in a very simple way? ...

Making a DateTime field in a database automatic?

I'm putting together a simple test database to learn MVC with. I want to add a DateTime field to show when the record was CREATED. ID = int Name = Char DateCreated = (dateTime, DateTime2..?) I have a feeling that this type of DateTime capture can be done automatically - but that's all I have, a feeling. Can it be done? And if so how?...

[r] Converting unix seconds in milliseconds to POSIXct/POSIXlt

Why do I see a difference when I convert a unix timestamp to datetime object in R? > as.POSIXlt(1268736919, origin="1970-01-01", tz="America/New_York") [1] "2010-03-16 06:55:19 EDT" > as.POSIXct(1268736919, origin="1970-01-01", tz="America/New_York") [1] "2010-03-16 11:55:19 EDT" The result from POSIXlt is actually correct. Also, is...

MySQL DATETIME format comparison - is strtotime needed?

I've been doing something along the lines of.. $dt1 = '1000-01-01 00:00:00'; //really some val from db $dt2 = '1000-01-01 00:00:10'; //another val maybe db maybe formatted if(strtotime($dt1) > strtotime($dt2){ //do something } Is the strtotime needed? can i do a more direct comparison on the datetime formatted strings? i.e. if($dt1...

In Python, if I have a unix timestamp, how do I insert that into a MySQL datetime field?

I am using Python MySQLDB, and I want to insert this into DATETIME field in Mysql . How do I do that with cursor.execute? ...

How do I do this query in MySQL? (datetime)

Suppose I have a datetime column in MySQL. How do I select all that have a datetime within 2500 seconds of the current datetime? SELECT ALL where current_datetime - that_datetime < 2500 ... ...

String / DateTime Conversion problem (asp.net vb)

I have this code: Dim birthdaystring As String = MonthBirth.SelectedValue.ToString & "/" & DayBirth.SelectedValue.ToString & "/" & YearBirth.SelectedValue.ToString Dim birthday As DateTime = Convert.ToDateTime(birthdaystring) Which produces errors (String was not recognized as a valid DateTime.) The string was "01/31/1963". Any assi...

searching between dates in MYSQL in this format 03/17/10.11:22:45

I have a script that automatically populates a mysql database with data every hour. It populates the date field like 03/17/10.12:34:11 and so on. I'm working on pulling data based on 1 day at a time from a search script. If i use SELECT * FROM call_logs WHERE call_initiated between '03/17/10.12:00:00' and '03/17/10.13:00:00' i...

Why is sql server giving a conversion error when submitting date.today to a datetime column?

I am getting a conversion error every time I try to submit a date value to sql server. The column in sql server is a datetime and in vb I'm using Date.today to pass to my parameterized query. I keep getting a sql exception Conversion failed when converting datetime from character string. Here's the code Public Sub ResetOrder(ByVal con...