How do I set the timezone of a datetime instance that just came out of the datastore?
When it first comes out it is in UTC. I want to change it to EST.
I'm trying, for example:
class Book( db.Model ):
creationTime = db.DateTimeProperty()
When a Book is retrieved, I want to set its tzinfo immediately:
book.creationTime.tzinfo =...
Extends
Ok, we are not having a good day today.
When you attach the correct tzinfo object to a datetime instance, and then you strftime() it, it STILL comes out in UTC, seemingly ignoring the beautiful tzinfo object I attached to it.
# python 2.5.4
now = datetime.now()
print now.strftime( "%a %b %d %X" ) # %X is "locale's...
I have two date fields with times.They are
1.2008-06-09 10:18:00.000
2.2008-06-10 11:20:00.000
I have to find the difference between the above two dates in the format -
"24 hour:2 minutes:0 seconds"
Is there any method to get this result in sql 2000?
...
Given 2 dates, how can i calculate the number of hours/minutes between them, excluding weekend time (since Friday 17:30 till Monday 09:00)
The script queries a MySql database but i assume this sort of calculations would be easier in php.
I'm thinking of a iterative function to determine the weekday and keep looping until last date would...
I can get Monday this week with:
$monday = date_create()->modify('this Monday');
I would like to get with the same ease the 1st of this month. How can I achieve that?
Thanks
...
The code for the date and time function:
function date_and_time($format,$timestamp) {
$date_and_time = date($format,$timestamp);
return $date_and_time;
}
And then the code to display it:
<?php
echo date_and_time("dS F Y", strtotime($profile[last_activity_date_and_time]));
?>
The value of $profile[last_activity_d...
I'm trying to update an object, and getting:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
There are two fields in the object that are DateTime objects, and they're set with:
obj.created_date = DateTime.Now;
obj.modified_date = DateTime.Now;
Except that everything looks reasonable when ...
I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries.
...
So I'm building an application where data is coming back from a database where the date could be in many different formats, ie '2008', '05/22/99', '8/20/2004'. And lets say, for example, a user wants to edit a date (2009) by clicking the "Edit" button. Well in the edit window it SHOULD show an input box with the year '2009' already prese...
Please kindly explain what is the impact of the system like shopping cart in which one customer(buyer) sits in one timezone and the other(seller) is on other timezone and the date is changed at one end. so the report data for one customer who bought is different than the other.
...
I have a SPARQL query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX person: <http://www.myOntDomain/person#>
PREFIX likedEvent: <http://www.myOntDomain/likedEventRule#>
PREFIX event: <http://www.myOntDomain/event#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLS...
GWT doesn't serialize Java Date properly. When I tried sending Date created in Javascript through the wire, I found out that dates between April 1st (funny) and 25th October for years before year 1983 get subtracted by one day.
That means that, say, both 1982-04-01 and 1982-03-31 become 1982-03-31 on the Java side.
Given the dates in q...
convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC,
Looking into DateTime but I don't see how to parse the string?
UPDATE:
Is this working correctly?
require 5.002;
use strict;
use warnings;
use DateTime::Format::DateManip;
my $string = '2010-02-28 00:00:00';
my @dates = (
$string
);
for my $date ( @date...
I will be storing datetime values in an SQLite database (using Delphi and the DISqlite library). The nature of the db is such that it will never need to be transferred between computers or systems, so interoperability is not a constraint. My focus instead is on reading speed. The datetime field will be indexed and I will be searching on ...
Hi. It seems I can't compare 2 date values with time.
When I compare just date part - year, month and day - everything works fine. But when I add comparing times everything breaks down and not even month fits.
So what's some basic algorithm for comparing 2 dates? I mean generally, I can't juse use dateTime1.CompareTo(dateTime2). Prefer...
time_t rawtime;
struct tm *mytm;
time_t result;
time(&rawtime);
mytm=localtime(&rawtime);
mytm->tm_mon=month-1;
mytm->tm_mday=day;
mytm->tm_year=year-1900;
mytm->tm_sec=0;
mytm->tm_min=0;
mytm->tm_hour=0;
result = mktime(mytm);
Above code snippet,I'm expecting result to display the no.of seconds lapsed since 1970,jan-1st for th...
I have a file containing many columns of text, including a timestamp along the lines of "Fri Jan 02 18:23" and I need to convert that date into MM/DD/YYYY HH:MM format.
I have been trying to use the standard 'date' tool with awk getline to do the conversion, but I can't quite figure out how to pass the fields into the 'date' command in ...
Hey!
I've published a web application to a server in the USA. The app is actually for swedes (people in Sweden) and I am looking for the best way to hadle the time difference.
There's a +7 hour difference.
Should I store the DateTime.Now in DB as it is, or should I use DateDiff to change the time before creating each record?
What's t...
hi
How can I format the following datetime values:
2010-01-21 00:00:00.000 - as - 21/01/2010
and
1900-01-01 09:09:18.000 - as - 09:09:18
...
I'm working on a journal-type application in Python. The application basically permits the user write entries in the journal and adds a time-stamp for later querying the journal.
As of now, I use the time.ctime() function to generate time-stamps that are visually friendly. The journal entries thus look like:
Thu Jan 21 19:59:47 2010 Di...