datetime

How to compare two time in PHP

i had two times in the format like 7:30:00 and 22:30:00 stored in the variable $resttimefrom and $resttimeto respectively I want to check whether the current time is between this two values. I am checking this with the code $time =date("G:i:s"); if ($time >$resttimefrom and $time <$resttimeto ) { $stat="open"; ...

How to protect software from system date-time changes?

I would like to add licensing system to application. For example: user buys license for 1 month and after that program expires (Kinda Anti-Virus style?). Problem is that application is supposed to run in systems which may or may not be connected to internet, so how to protect from date-time changes? Storing app startup and close times ...

Date/Time parsing in C++ (Any format string to Epoch)

I am writing a C++ app that has to parse a date/time string and give out epoch time. But the format of the date/time string can be more than one (actually say 25 formats) like "EEE, dd MMM yyyy HH:mm:ss '('ZZZ')'", "EEE, dd MMM yyyy HH:mm:ss '\"'ZZZ'\"'", "EEE, dd MMM yyyy hh:mm:ss z", "EEE, dd MMM yyyy HH:mm Z", "E...

How to calculate the local datetime from a utc datetime in tsql (sql 2005)?

Hi, i want to loop over a period of time in tsql, and print the utc datetimes and our local variant. We live in UTC +1, so i could easily add 1 hour, but in the summertime we live in UTC +2. In C# i can create a datetime and use a method to ask for the UTC variant and vice versa. Till now i have this: declare @counter int declare @l...

Parsing a TeamCity (Java?)-generated timestamp in .NET?

I'm attempting to integrate with the TeamCity REST API. It contains timestamps of the form 20100804T104413+0100. It's almost ISO 8601, but doesn't contain the hyphens. How do I convert this from a string to a DateTime in .NET? I've tried: DateTime.ParseExact(s, "yyyyMMddTHHmmss+zzzz", CultureInfo.InvariantCulture); (and without the +...

Store dates in MongoDB as integer rather than MongoDate value

Are there any disadvantages to storing dates as integers (timestamps) in MongoDB rather than its MongoDate format? Because I'm having problems with Zend Framework and Doctrine ODM to read the data, since I get them returned as an array as DateTime object. Internally MongoDB seems to save them as Timestamps, but has its own object for it...

string to datetime with fractional seconds, on Google App Engine

Hey all, I need to convert a string to a datetime object, along with the fractional seconds. I'm running into various problems. Normally, i would do: >>> datetime.datetime.strptime(val, "%Y-%m-%dT%H:%M:%S.%f") But errors and old docs showed me that python2.5's strptime does not have %f... Investigating further, it seems that the Ap...

How do I calculate someone's Age?

Possible Duplicate: How do I calculate someones age in C#? How do I calculate someone's age in C#, if I have their Birthdate and today's date? ...

How do I convert month names to int?

I have a column called Month in a stored proc which returns to me the month in string name terms (eg. January, Febuary, March etc.) I would like to convert that to an integer. Is that possible without just using a number of select case statements? I would like to do this in .NET 3.5 ...

jquery date and time picker

hi, i am using jquery date and time picker in one my project where users can create an event. in the jquery datepicker, i have the option to select the today's date and future date and not the past date which is good for an event creattion website. but i am stuck with the time picker. for example, if i am in the event creation page(assu...

Xml Schemas and Date Times

I'm beginning a new project which involves heavy xml and schema use accross multiple platforms (windows, windows mobile, Iphone, Ipad, and more which are yet to be discovered!). This xml platform has to be able to exchange date times from all over the world as our product is currently being implemented in Australia as well as in Canada ...

Convert somebody's local time to the UTC time

Hi, i'm a little lost in the timezone :) I have data stored with the time in UTC. The server is in the Netherlands, so we live in utc+1 (now, with daylightsavingtime, in utc + 2) Now a client says: give me the data from august 5th. So i have to calculate the utc time from 'his time'. For that i have to know: what is your utc offset...

MySQL - Convert MM/DD/YY to Unix timestamp

The title says it all; is there an easy (single query) way to do this? I'm reading those values from a column in a table and I think that the column itself is defined as a string (can't be helped, i'm afraid). Thanks guys. ...

How to save datetime in EDB database

I want to save datetime into the EDB database. I tried storing the value by converting CTime to CString. But after reading not able to convert CString to Ctime. Ask the same question on stackoverflow, yet no responses. Here are EDB database datatypes. Can I use CEVT_FILETIME? If possible please give me an example. ...

Date/Time parsing in C++

While doing the data/time parsing in c++ (converting a string in any format to a date), i found the following useful methods 1) strptime() - here the %d, %m etc can have either 1 or 2 characters. The function will take care of that. As a result of this it will enforce that we use a separator between two conversion specifiers. Ex: Its n...

Sharepoint RenderPattern and "neutral" DateTime values

Hi there I created a custom Sharepoint field and a custom renderplattern for it: <RenderPattern Name="DisplayPattern"> <Column Name="Date" HTMLEncode="FALSE" Format="DateTime"/> </RenderPattern> So basically it is writing out the raw value of the "Date" field. Currently I'm using the output clientside using Javascript: ....

Parameterizing php code with DatePeriod, DateInterval classes

Hi, I dont understand DatePeriod, DateInterval classes very well. This question is linked to another one - http://stackoverflow.com/questions/3386952/how-to-display-converted-time-zones-in-a-generic-week-sunday-thru-saturday wherein I want to parameterize the solution offered by artefacto. Help would be appreciated! This is artefacto'...

PHP time substraction

I am trying to substract 24 hours time format and then convert it into minutes but it does not work well. Here is my code $time1 = '2010-08-05 23:00:00'; $time2 = '2010-08-05 00:00:00'; echo round( (strtotime($time2) - strtotime($time1)) / 60); it will display this -1380. if you put 1-23 hour in time2 it will work. I tried to conve...

perl help finding proper date format

I need some help trying to figure out how to format dates in perl. I have a working perl script, with a regular expression, that works fine if I use hard coded date strings like this: my $mon = 'Aug'; my $day = '05'; my $year = '2010'; These vars are used in a regular expression like this: if ($line =~ m/(.* $mon $day) \d{2}:\d{2}:\d...

Problem with strptime() - %p is not taken into account

I am trying to convert a date in a particular format using strptime, and i realized that the information about AM/PM is lost. Not sure why. Here is the code. struct tm t; strptime("Wed 4/18/2007 4:28:22 PM", "%a %m/%d/%Y %H:%M:%S %p", &t); std::cout<<t.tm_hour<<endl; strptime("Wed 4/18/2007 4:28:22 AM", "%a %m/%d/%Y %H:%M:%S %p", &t); ...