datetime

PHP/MySql - DateTime detecting if values was assigned?

I want to make an if statement that only runs if the datetime value is NOT null (0000-00-00 00:00:00) I have passed the value via a query into a variable but how do i determine if it equals 0000-00-00 00:00:00? $query = "SELECT * FROM stats WHERE member_id='" . $_SESSION['SESS_MEMBER_ID'] . "' "; $result = mysql_query($query); while(...

Number of years between two dates

I am trying to do a fairly trivial task however my experience is in .net not in vb6. Given two strings (say "10/17/94" and "10/17/95" for this example) I want to return a string expression X years //Date_Due and Date_Time_Performed are strings in the mm/dd/yy format Duration = (Year(CDate(Date_Due)) - Year(CDate(Date_Time_Performed))) ...

write time on FTP server is very off

im trying to compare file write times between a local file and a file on an ftp server. the file times on the local machine work and it makes sense, but when I look at the file on the ftp server it shows two different times, via windows explorer and rightclick->properties. I found out a hack that works and its commented in my code. Any h...

What's the standard way to work with dates and times in Scala? Should I use Java types or there are native Scala alternatives?

What's the standard way to work with dates and times in Scala? Should I use Java types such as java.util.Date or there are native Scala alternatives? ...

Typed Dataset - DateTime column value null in database

This is the code generated by the designer: [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public System.DateTime dcDateOfPayment { get { try { return ((global::System.DateTime)(this[this.tabledtAllInvoices.dcDateOfPaymentColumn])); ...

Mysql/Php - Current date and time

I have a query that I want to update a collum with the current date time. The collum I want to update is of the type datetime. How can I get it and set it? else{ //If the last update is NULL, It must be players first page load. So set datetime equal to NOW $query = "UPDATE `stats` SET `last_ap_update` = WHERE `member_id` = {$_S...

How to calculate timedelta until next execution for scheduled events

I have three lists that define when a task should be executed: minute: A list of integers from 0-59 that represent the minutes of an hour of when execution should occur; hour: A list of integers from 0-23 that represent the hours of a day of when execution should occur day_of_week: A list of integers from 0-6, where Sunday = 0 and Satu...

Date and time in Matlab on x axe

I have a txt file as 20100318,1630,17.3600,17.3700,17.2900,17.3000,150408 20100318,1700,17.3000,17.3200,17.2700,17.3200,69629 20100318,1730,17.3100,17.3100,17.3100,17.3200,0 20100319,900,17.4000,17.5600,17.3500,17.5100,460691 20100319,930,17.5100,17.5400,17.4200,17.4200,143917 where first and second columns are Date and Time with comm...

Rails "moments ago" instead of created date?

Hi Everyone, Currently I have the following in my helper: def created_today k if k.created_at.to_date == Date.today then content_tag(:span, 'Today', :class => "todayhighlight") else k.created_at.to_s(:kasecreated) end end What I would like to do is replace TODAY with MOMENTS AGO if the created_at time is within th...

Evaluating the current Hour in Delphi

I'm looking for the Delphi eqivalent to the following Ruby Code if Time.now.hour > 12 then # Statement; else # Alternative Statement; end Thanks Stefan ...

Entity framework date/time conversion for sqlserver

I prefer working with DateTime.MinValue, even if I use SqlServer as backend. Is it possible to make EntityFramework to convert from DateTime.MinValue to 1753-01-01 when saving entities and convert back to DateTime.MinValue when fetching them? Edit: I do not want to use DateTime? (nullable value type) ...

mysql and 30 days

i'm working on a site that handles free subscriptions and i will like to now how to cancel their subscriptions after 30 days inactivity, i know that this has to be done with cron-jobs but i have no idea on how to count 30 after the last time the user logged in? ...

C#: Edge Cases when removing a subset of a day from a TimeSpan on a daily basis

I'm trying to determine a TimeSpan (eg., time between logout and login), but with the caveat that a part of each day shouldn't be counted (eg., don't count the time between 7PM and 7AM on a given day). Removing that time from full days is easy enough, but what's the best way to check for parts of a day (eg., user logs out at 6PM and log...

MySQL/PHP - Time Passed

How can I calculate the amount of 5 minuet periods passed with a datetime type? is it possible? //Update AP (+1 points every 5 mins) // PLAN OF ACTION (for ap update)! // 1. check how long it has been since last update // 2. calculate how many 5 min periods has passed // 3. update $ap accordinly if ($last_ap_update != "000...

PHP urlencode / urldecode of date(DATE_ATOM) issue

Hi I am producing a google calendar query string that requires an atom fomatted date. I am using php 5.1.6, and date(DATE_ATOM) to produce the correctly formatted current date. So, for instance, in the unencoded url part of the query has: start-max=2010-09-02T10:25:58+01:00 I need to rawurlencode this and it becomes start-max%3D20...

Syntax error converting datetime from character string.

Getting this error when updating a row via a gridview with a sqldatasource in Vb.net/SQL Server 2000. No matter what input (1/1/2010, blank, etc) I give it I can't seem to get it right. Code before the input is passed to the sp: Dim sqldatenull As DateTime Dim DateVerify As DateTime sqldatenull = DateTime.MaxValue ...

PHP DateTime equality

How can I compare if two DateTime objects have the same day,month and year? The problem is they have different hours/min/seconds. ...

Convert varchar 114 on datetime equals what?

I have trouble in setting the equal condition on a datetime field after converting it to hh:mm:ss.mmm: select top 1 convert(varchar, timestamp, 114) from TEST_TABLE /* returns a single entry of 11:33:35:000 */ Then I want to find all entries with that timestamp: select * from TEST_TABLE where convert(varchar, timestamp, 114) = '11:3...

How to represent a .NET DateTime 24-hour format in 01-24 instead of 00-23?

I have a strange business requirement to output dates as 01:00 through 24:00, instead of the usual 00:00 through 23:00. It is really a crazy requirement, but unfortunately I don't think I can avoid it. This will be a configuration option in our software, so I'll still need to support the normal 00-23 as well, so I'm hoping I can do thi...

DateTime Not showing with currentculture format in Datagrid,ListView

In WPF I am trying to Bind a Date property to Datagrid, and If I only have the date Property binded as DateTime format I can sort it in the datagrid. And Here I have to show the regional Date, If the user changes the Region and Language settings, The application should show the resepective time format. Here comes the Issue, When the Da...