datetime

PRTime to datetime in Python

Hey guys, I'm writing a script that is retrieving information from places.sqlite (history) and realized that it store the time in PRTime format. Is there a method available in python which could convert this date time or do i have to make it myself? ...

Does VBScript have a DateTime.TryParse equivalent?

Given a variant, does VBScript have an equivalent of C#'s DateTime.TryParse method? ...

How can I convert this "Tuesday, March 30, 2010 10:45 AM" string to a DateTime practically?

Well, This is a string I get from a web service: "Tuesday, March 30, 2010 10:45 AM" and I need to convert it to a DateTime. Do you know a simple way to achieve this? Thanks, ...

Java: comparing two Dates to see if they are in the same day

I need to compare two Dates (e.g. date1 and date2) and come up with a boolean sameDay which is true of the two Dates share the same day, and false if they are not. How can I do this? There seems to be a whirlwind of confusion here... and I would like to avoid pulling in other dependencies beyond the JDK if at all possible. to clarify: ...

Formatting a date string when the string sits inside another string

Hi, I'm trying to figure out a way to format a date string that sits inside string using javascript. The string can be: "hello there From 2010-03-04 00:00:00.0 to 2010-03-31 00:00:00.0" or "stuff like 2010-03-04 20:00:00.0 and 2010-03-31 00:00:02.0 blah blah" I'd like it to end up like: "stuff like 4 March 2010 and 31 March 2010 ...

How to get aggregate days from PHP's DateTime::diff?

$now = new DateTime('now'); $tomorrow = new DateTime('tomorrow'); $next_year = new DateTime('+1 year'); echo "<pre>"; print_r($now->diff($tomorrow)); print_r($now->diff($next_year)); echo "</pre>"; DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 10 [i] => 17 [s] => 14 [invert] => 0 [days] => 6015...

jaxb unmarshal timestamp

I cannot get JAXB to unmarshal a timestamp in a Resteasy JAX-RS server application. My class looks like this: @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name = "foo") public final class Foo { // Other fields omitted @XmlElement(name = "timestamp", required = true) protected Date timestamp; public Foo() {} ...

Time zone for Force.com API fiscal date literals?

I have a question about fiscal date literals in the Force.com API (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm): For which time zone are date ranges calculated? For example, suppose we execute the query: SELECT Id FROM Opportunity WHERE CloseDate = THIS_FISCAL_QUARTER where, ac...

SQl queries searching by date range

Hi, I have a table in an Access 2007 database. All fields are of type text. Can the following be done using the where clause? If so how? SELECT * from Table1 WHERE (ColumnDate is between 26th and 19th of march 2010) SELECT * from Table1 WHERE (ColumnAge is between 25 and 40) The usual < <= operators don't seem to work. Thanks, ...

show the message time in the inbox php

Hi i am doing internal mail service application , i have the field called datetime in my table, i want to show the mail datetim in the inbox view somthing like gmail inbox, i want to show if the mail came just 10 min aga means , i want to show 10min ago, if mail came around 2 days back means i want to show the DATE-Time , Thing ke...

XMlSerialization is not serializing a Datetime

When I serialize an object which has a DateTime in it this is returning empty in the XML string. Please see below for my XSD, serializable class generated from the XSD, and serialization helper class which handles the serialization of the XSD. XSD: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="test" xmlns="" xmlns:xs="ht...

Check whether the string is a unix timestamp

I have a string and I need to find out whether it is a unix timestamp or not, how can I do that effectively? I found this thread via Google, but it doesn't come up with a very solid answer, I'm afraid. (And yes, I cribbed the question from the original poster on the aforementioned thread). ...

Can SQLAlchemy DateTime Objects Only Be Naive?

I am working with SQLAlchemy, and I'm not yet sure which database I'll use under it, so I want to remain as DB-agnostic as possible. How can I store a timezone-aware datetime object in the DB without tying myself to a specific database? Right now, I'm making sure that times are UTC before I store them in the DB, and converting to local...

jQuery: How can I work with dates in this format? mm/yyyy

I'm doing a web application for articles Articles must be shown by month, with its published date stored as mm/yyyy Now: 1- Should I use a DATE type field for storing? 2- Will jQuery UI datePicker be useful for showing mm/yyyy? 3- How could I sort by mm/yyyy? I guess it will be more complicated if I store date normally and extract the...

Problem with TimeZoneInfo.ConvertTime: missed the Daylight Saving switch.

My web app runs on .Net 3.5, all of the dates are saved on the DB in UTC time (not in user time). When I want to display a date I convert it to user date (from UTC) //Get the current datetime of the user exp: GMT TO ISRAEL +2 public static DateTime GetUserDateTime(DateTime dateUTC) { string userTzId = "Israel S...

Daylight saving time and Timezone best practices

I am hoping to make this question and the answers to it the definitive guide to dealing with daylight saving time, in particular for dealing with the actual change overs. If you have anything to add, please do Many systems are dependent on keeping accurate time, the problem is with changes to time due to daylight savings - moving the c...

Convert a mysql date (datetime) into a better date format using php

I some php code which gets info from a mysql database. The problem is that the date is coming out in the format : 2010-02-03 22:21:26 Does anyone know a simple solution to make the date more user friendly format. e.g 2nd march 2010 at 22:21. Thanks ...

MySQL: What's the best to use, Unix TimeStamp Or DATETIME

Hello, Probably many coders want to ask this question. it is What's the adventages of each one of those MySQL time formats. and which one you will prefer to use it in your apps. For me i use Unix timestamp because maybe i find it easy to convert & order records with it, and also because i never tried the DATETIME thing. but anyways i'm...

Problems with Runt overlap? but *only* within Rails

Martin Fowler's Runt library is really handy for date/time comparisons, and this code works great in an irb console: require 'runt' include Runt r_start = PDate.month(2010,12) r_end = PDate.month(2011,12) range = DateRange.new(r_start,r_end) o_start = PDate.month(2010,11) o_end = PDate.month(2012,2) o_range = DateRange.new(o_start,o_en...

How to pass null as DateTime value?

In a database, there is a field that saves a closure date. This date can be NOT NULL only if the case has been closed. If the case is not closed, it has to be NULL. How can I pass null value to a DateTime object? Tried this but it doesn't work. DateTime closure= dateDatumIspisa.SelectedDate ?? null; DateTime closure= dateDatumIspisa.S...