datetime

Specify time zone of log4j's date

Is it possible to specify the time zone that log4j will use? I need the dates in the log file to be a different time zone than the application's. log4j's PatternLayout uses SimpleDateFormat. Unfortunately there doesn't appear to be a way to control SimpleDateFormat's time zone via the pattern string (DateFormat has setTimeZone method but...

What is the time format for APNS?

I want to show alert on a specific time on iphone using push notification.I have gmt +530 timezone in my local app.Suppose current time is 16:04:08 Gmt +530 and i want notification after one hour so currently I am converting it into UTC format and storing this time and alert message on server database. i want to know will i get the notif...

get custom date time format

I want to display date time as eg. Dec 1, 09 11:22:45 PM using SQL query Currently my format is : DATENAME(Month, (((MachineGroups.TimeAdded*10000000)+ 621355968000000000) -599266080000000000) / 864000000000) + SPACE(1) + DATENAME(d, (((MachineGroups.TimeAdded*10000000)+ 621355968000000000) - 599266080000000000) / 864000000000) +', ' ...

Python: parsing date with timezone from an email

I am trying to retrieve date from an email. At first it's easy: message = email.parser.Parser().parse(file) date = message['Date'] print date and I receive: 'Mon, 16 Nov 2009 13:32:02 +0100' But I need a nice datetime object, so I use: datetime.strptime('Mon, 16 Nov 2009 13:32:02 +0100', '%a, %d %b %Y %H:%M:%S %Z') which raise V...

C#, NUnit: Is it possible to test that a DateTime is very close, but not necessarily equal, to another?

Say I have this test: [Test] public void SomeTest() { var message = new Thing("foobar"); Assert.That(thing.Created, Is.EqualTo(DateTime.Now)); } This could for example fail the constructor of Thing took a bit of time. Is there some sort of NUnit construct that would allow me to specify that the Created time don't have to be ex...

localize strftime rails 2.2

<% @recently_active_objects = Activity.find(:all, :limit => 10, :order => "id DESC") %> <% @recently_active_objects.group_by{ |object| object.created_at.midnight }.each do |day, objects| %> <h3><%= day.strftime("%A, %B %e") %></h3> <% objects.each do |object| %> <%= activity_message_for_activity(object) %> ...

Change DateTime in debugger

What the.... How do I change the value of a DateTime in the debugger? I can change it, but I get an error when leaving the edit field; it cannot parse it. Edit: VS 2008, C# ...

Datetime selection query group by day.

Hello, I've got a question for my SQL query I've got too write. It's a long time ago since I've written an query so I could use some help with mine. I've tried looking for examples but didn't find the right result. Ive written an query but its really isn't working for me.. What im trying to do is get the sum of the total power consumptio...

time_ago_in_words and localize

Is it possible to use time_ago_in_words with i18n.locale? how? thanks ...

DateTime.ParseExact formats question

I have datetime strings that look can like any the following: "1 13 2009 2300", "1 14 2009 0", "1 14 2009 100" that I need to parse into a DateTime. I have tried: string[] sExpectedFormats = {"M d yyyy Hmm", "M d yyyy hmm", "M d yyyy 0"}; DateTime dtReportDateTime = DateTime.ParseExact(sReportDateTime, sExpectedFormats, System.Gl...

WPF Toolkit DatePicker Month/Year Only

Hi, I'm using the Toolkit's Datepicker as above but I'd like to restrict it to month and year selections only, as in this situation the users don't know or care about the exact date .Obviously with the data being stored in a Datetime format there will be day stored but that doesn't concern me. Is there an easy way to tie this down? T...

Why does not init:stop() terminate directly?

My code for display all days in this year. I don't understand why if NewSec =< EndSec -> init:stop() end did not execute the first time in run_calendar? I expect init:stop() could be executed first time but it is not. What is wrong? Code: -module(cal). -export([main/0]). main() -> StartSec = calendar:datetime_to_gregorian_se...

Silverlight Date Formats

Hello everyone, I'm getting some very strange date formatting issues in my Silverlight application. My local culture is set to UK, yet I am consistently seeing US dates popping up all over the place. I can easily hardcode these to UK format in specific loactions using: <UserControl ... Language="en-GB"...> But as I'm sure you'd all ...

understanding dates/times (POSIXc and POSIXct) in R

I'm reading a table and it contains strings that describe timestamps. I just want to convert from string to a built-in datetime type... R> Q <- read.table(textConnection(' tsstring 1 "2009-09-30 10:00:00" 2 "2009-09-30 10:15:00" 3 "2009-09-30 10:35:00" 4 "2009-09-30 10:45:00" 5 "2009-09-30 11:00:00" '), as.is=TRUE, heade...

Get difference in two different timestamps in Blackberry application

Hi All, I would like to know how to calculate difference between two different timezones / timestamps in Blackberry application. For e.g. Calculate difference in server timestamp and client timestamp Please help. Thanks. ...

notepad++ insert time and date, and the directory path

I just downloaded np++ v 5.3.1 and I'm having two problems with the TextFX plugin: 1) I recorded a macro with "TextFX Insert" > Date & Time (no matter whether short or long format) and, after I run the macro, only the first number of the time appears (i.e. I ask to insert time and it says its 8:59 AM 11/27/2009; but when I run the macro...

How to setTimeStyle AM/PM to lowercase using the iPhone SDK

How can I set the AM / PM time style to lowercase? I'm using the following code and according to Apple's documentation this should returned these values as lowercase but it doesn't. [_detailsTimeFormatter setTimeStyle:NSDateFormatterShortStyle]; ...

Parsing date strings

I'm writing XSLT to transform an XML document from one DTD to another and in the process of doing so trying to tidy up some date strings. Each record in my source document has a date element that contains a string representation of a date. Some illustrative examples: 11 April 1995 14th April 1995 10 Sept 2002 14 Sep 2004 21-23 June 2...

Datetime nightmare, any thorough module or control in C# to help ease the pain?

once again I have to create a date module, and once again i live the horror of perfecting it, is it me or are date and time the filthiest animals in programming profession, its the beast lurking behind the door that I wish I never have to deal with :( does anyone know of a great source I can learn from that deals with dates in the follo...

What is the range for the DATE type in Core Data?

I'm putting together an application that will require the recording of dates as far back as the BC range; can Core Data's date type handle this, or do I need to define another entity to properly record and format dates? ...