datetime

comparing dates in PHP and MYSQL

I am trying to figure out what is the best way to Grab the current date/time (is date('Y-m-d H:i:s') best?) Grab the db date from SQL Check if the current date (#1) is between the date pulled from the DB and 5hours after it I'm a newbie at php. ...

Full-featured date and time library

I'm wondering if anyone knows of a good date and time library that has correctly-implemented features like the following: Microsecond resolution Daylight savings Example: it knows that 2:30am did not exist in the US on 8 March 2009 for timezones that respect daylight savings. I should be able to specify a timezone like "US/Eastern" a...

default timezone error in php

I got the following error/warning while tring to install Kohana/SilverStripe.What does it mean and What do I do for it? Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of t...

Adjusting time zone in PHP with DateTime / DateTimeZone

There's a lot of info on doing time zone adjustments in PHP, but I haven't found an answer for specifically what I want to do due to all the noise. Given a time in one timezone, I want to convert it to the time in another timezone. This is essentially what I want to do, but I need to be able to do it using only the built-in PHP libs, ...

C# Nullable<DateTime> to string

I have a DateTime? variable, sometimes the value is null, how can I return an empty string "" when the value is null or the DateTime value when not null? ...

Convert C# DateTime object to libpcap capture file timestamp

Hi there Call me a noob, but i am stuck in converting a DateTime object to a timestamp for the libpcap capture file format (is also used by wireshark, file format definitiom here: http://wiki.wireshark.org/Development/LibpcapFileFormat) in C#. The timestamp i can't manage to convert my object to is the Timestamp in the packet (record) h...

DateTimePicker: Selecting a range of hours within a single day only

I'm looking for a way to use two DateTimePicker controls to select a range of hours and minutes within one day. That is, to basically select a 'starting time' and 'ending time'. I started with two DateTimePicker controls with the custom format of h:mm tt. I tried adding (on ValueChanged), a check that made the selected 'starting time' w...

Java does not seem to accept Romance as timezone alias. What should it be?

I'm trying to convert a date string from another application in Groovy. Something like "18-sep-2009 10:25:11 Romance Daylight Time" It looks like Java does not understand the Romance as timezone alias. "18-sep-2009 10:25:11 Pacific Daylight Time" works fine. Is there a fix for this other than parse the string and replace "Romance Dayl...

T-SQL: Convert datatime2 to datetime for all columns of type datetime2

I've got a database full of datetime2 columns than needs to be moved to a SQL 2005 database. So, I need to convert all these datetime2(7) columns to datetime. How can I go about doing this? Right now I've managed to select the table name and column name for all columns with the datetime2 datatype like this: SELECT t.name, c.name, i.DA...

SSIS related Question

This is my SSIS excerise I have a DATETIME column, what I want is to get the Month and Year from " DATETIME " column and load it into a new column called “Month_Year” and then get day from the same " DATETIME " and load it into a new column called "day" Visually Source Column: DATETIME Destination Column: Month_Year Day B...

How do I partition datetime intervals which overlap (Org Mode clocked time)?

I have related tasks from two Org files/subtrees where some of the clocked time overlaps. These are a manual worklog and a generated git commit log, see below. One subtree's CLOCK: entries needs to be adjusted to remove overlapping time. The other subtree is considered complete, and it's CLOCK: entries should not be adjusted. EDIT: Thi...

PHP Get hour difference in datetime

Hi, so I have these two time stamps in PHP 1253339331 1253338959 I want to be able to somehow get the hour difference between those to datetimes. Our users should only have 24 hours to login after their first attempt, so I need to find out if it's less than 24 hours to allow them to login again. ...

How do I fix inconsistencies when converting file dates to/from TDateTime

I'm caching files locally in my 3 tier app. To check whether to read the file from the local cache or from the server I compare file dates. I've found that there when converting file dates to TDateTime and viceversa there are inconsistencies and values that should match rarely do. Here's some code that demostrates the problem procedure ...

In LINQ to SQL, How to return datetime in ISO 8601 String, IETF String or timestamp?

In LINQ to SQL, how can I convert this format: "VDate(1253451600000+0200)V" to an ISO 8601 string, IETF string or timestamp format? I'm using WCF JSON-Enabled and Ajax-Enabled web service. ...

Is TimeSpan unnecessary?

EDIT 2009-Nov-04 OK, so it's been a little while since I first posted this question. It seems to me that many of the initial responders failed to really get what I was saying--a common response was some variation on "What you're saying doesn't make any sense"--and so I've made some handy diagrams to really illustrate my point. When we ...

How to I fix this MSS 2008 BULK INSERT datetime precision error?

An MS SQL Server 2008 BULK INSERT to a datetime column introduces an error in the 3rd decimal place of the seconds portion: 2009-09-19 15:02:41.328 in the input file becomes 2009-09-19 15:02:41.327 in the database. Here is what the input text file contains: 1 2009-09-19 15:02:41.328 Here is what the table looks like after BULK INS...

datetime.tostring issue in vb.net

Hello, I have a variable for startdate as shown below. Dim startDate as Datetime startDate = Convert.ToDateTime(datepicker1.text).ToString("dd-MMM-yyyy") In the immediate window if I try Convert.toDate(datepicker1.text).toString("dd-MMM-yyyy") it is showing date as 29-Sep-2009 but the value of startDate is 09/29/2009 I really don't...

Creating a date from a text string - VB.Net

I having a problem converting a string into the date format I need. An example of the string I'm trying to convert would be 215056081909. I would like to convert that string into 08/19/09 21:50:56. The code listed below is what I'm trying to use for the conversion process. When I run the code I'm getting the error below and I'm pre...

displaying date field in the value of a datefield form

I am using CF8 and MySQL 5. I have a form with several date fields (one for each day and the form may have 10+ days of data on it) that the user can select different dates for and they all have different var names within a loop. The default values for these date fields is null in the DB. I can insert a date into a DATE column in MySQL ...

mysql error when comparing date (php)

I am not sure why this i get this mysql error. Originally i didnt have '' around the date. Then i tried ''' and '`' without any luck. Whats wrong? SELECT COUNT(user) WHERE user=1 AND pass_time<'2009-09-21 13:44:38'; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synta...