datetime

How to represent the current UK time?

Hi, I'm facing an issue while converting dates between my server and client where both is running in Germany. The Regional settings on the client machines could be set to both UK or Germany.I recieve a date from the server which is CET format, and I need to represent this time on UI as UK time. For example a time recieved from server li...

Rails timestamps don't use the right timezone

I'm a bit confused about timezones in rails. I want my rails app to use British Summer Time (like daylight savings in the US) for the timestamps set in updated_at and created_at in my models. I changed my environment.rb to say config.time_zone = 'London' The ubuntu server my app is on seems to use BST for it's time: in the comman...

how to get file create/update time in mercurial?

I'm writing my blog system(django), and my blog files are VCSed by mercurial, I want get files create/update time, how could I do this by using commandline or python? edit: this is a example: $ SOME_COMMAND xxx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12 xyx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12 xxy.txt 2010-12-13-04:12:12 2010-...

Best way to find the months between two dates (in python)

I have the need to be able to accurately find the months between two dates in python. I have a solution that works but its not very good (as in elegant) or fast. dateRange = [datetime.strptime(dateRanges[0], "%Y-%m-%d"), datetime.strptime(dateRanges[1], "%Y-%m-%d")] months = [] tmpTime = dateRange[0] oneWeek = timedelta(weeks=1) tmpT...

datetimepicker jquery script is not running after deployment of asp. net mvc 2 application

Hi, I have deployed asp.net mvc 2 application successfully. but let say there is view fro create user where I used code for datetime picker : <script type="text/javascript"> $(function() { $('#DateOfBirth').datepicker({ dateFormat: 'dd/MM/yy', changeMonth: true, changeYear: true }); }); ...

Copy values to an array based on half hourly time.

Hi, I'm receiving a bunch of values from my server for various dates with each value corresponding to half hour of a day,i.e for today there will be 50 values...it'll be a basic keyvalue pair like the one below valsFromServer[28/10/2010 00:00:00] = 23; valsFromServer[28/10/2010 00:30:00] = 100; valsFromServer[28/10/2010 01:...

rails 3 group by date a datetime column

Foo.group(:start_at).count(:id) How I can group this by date ? the "start_at" column is an datetime column ...

Django: provide month and year number as parameter in a template for use in template tag

Hi, I am a Django Beginner. I found this Django snippet to show a simple calendar on my web page. The function needed 3 parameters that one can provide within the template as follows: {% load calendar_tag %} <div> <div>Calendar: </div> {% get_calendar for 10 2010 as calendar %} <table> <tr> <th>Mon</th> <th>Tue</th>...

Get the GMT time given date and UTC offset in python

I have a date string of the following format '%Y%m%d%H%M%S' for example '19981024103115' and another string of the UTC local offset for example '+0100' What's the best way in python to convert it to the GMT time So the result will be '1998-10-24 09:31:15' ...

javascriptserializer date format issue

I am serializing a complex object with lot of properties of other Types and Lists to JSON form but the issue is with DateTime properties. I get the epoch time with JavascriptSerializer (rather than mm/dd/YYYY). Is there any way I can get the datetime in mm/dd/YYYY : HH.MM.SS form without modifying the class defination of the object i a...

How do I convert a datetime to a UTC timestamp in python

from http://docs.python.org/library/time.html time.mktime(t): This is the inverse function of localtime(). Its argument is the struct_time or full 9-tuple (since the dst flag is needed; use -1 as the dst flag if it is unknown) which expresses the time in local time, not UTC. It returns a floating point number, for c...

How to echo a formatted date in PHP from an array

I have a datetime column in MySQL let's call it $time. It's coming form a CakePHP form. If I try to echo it I get I just get "Array". If I print_r() on it I get: Array ( [month] => 10 [day] => 30 [year] => 2010 [hour] => 16 [min] => 30 ) I want to echo this out as a formatted date, nothing seems to work because it's not a string bu...

querying results from mysql in the last 3 hours?

i want to query blog posts from the database created in the last 3 hours, table blogs{id,blog_text,date} date format: datetime ...

c# DateTime Add Property without extension Method

I am writing a class library where i need to extend System.DateTime to have a property called VendorSpecificDay such that DateTime txnDate = DateTime.Today; VendorSpecificDayEnum vendorDay = txnDate.VendorSpecificDay; public enum VendorSpecificDayEnum { Monday, Tuesday, ShoppingDay, HolidayDay } I realize that this is a perfe...

codeigniter get time zone offset

i need to get the timezone offset value from the timezone data in codeigniter. Timezones i have are UM12, UM11, .... UTC.... UP10 UP11 UP12..... i need exact offset values. is there any direct method? ...

Python: How to get the sum of timedelta?

Python: How to get the sum of timedelta? Eg. I just got a lot of timedelta object, and now I want the sum. That's it! ...

Activerecord removes all zeros from the timestamp field.

Hi, I am using Ruby on rails. I am trying to retrieve timestamp column from particular table. Activerecord returns me the date, if timestamp contains all zeros. e.g: If timestamp stored is 2010-09-06 00:00:00:000, it returns me 2010-09-06. But if I have 2010-09-06 00:00:20:000, it returns me in the expected format(i.e: 2010-09-06 00:...

How to merge date and time as a datetime in Google Apps Spreadsheet script?

I've a Date column in 'dd/mm/yyyy' format and Time column in 'HH:MM AM/PM' format in Google App spreadsheet. In app script, I want to join these 2 values as a datetime. How can I do this? Example- date : 13/12/2010, time : 4:30 PM Then I want to get a combined value like '13/12/2010 4:30 PM' as a datetime object. I tried to parse date ...

ASP.NET to WCF serialization issue(?)

so, I've got something like this: there's an ASP.NET application (1) that references WCF service (2) that references .NET application (3). (1) creates query gives it to (2), (2) gets some info from (3), processes it and returns it back to the (1). And here's the issue - there's DataContract class for request (that is used by both (2) an...

Regular DateTime question

Hi, I'm writing a service but I want to have config settings to make sure that the service does not run within a certain time window on one day of the week. eg Mondays between 17:00 and 19:00. Is it possible to create a datetime that represents any monday so I can have one App config key for DontProcessStartTime and one for DontProcess...