datetime

PHP: DATETIME in array as object. How to echo

Hope that title isn't too cryptic. I have an array with a DATETIME object in it and I'm just trying to figure out how to echo this to a page. ["created"]=> object(DateTime)#3 (3) { ["date"]=> string(19) "2010-10-22 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" Can someone help me out? tried date() bu...

Return a Table of Payroll Dates from a SQL Stored Procedure

I'm working with SQL Server Reporting Services 2008, which is somewhat new to me, as most of my experience is with LAMP development. In addition, moving most of the logic to SQL as stored procedures is something I'm not very familiar with, but would like to do. Any help or direction would be greatly appreciated. I need a list of accep...

TimeZoneInfo|GetUtcOffset: A better solution?

Hi, I'm facing an issue wherein my server expects datetime objects in GMT format and my UI application always creates and manipulates all datetime objects according to local culture.I cannot change the culture as there are other functionalities which need the datetime objects to be according to the local format. I have written a convert...

convert string to datetime object

I'd like to convert this string into a datetime object: Wed Oct 20 16:35:44 +0000 2010 Is there a simple way to do this? Or do I have to write a RE to parse the elements, convert Oct to 10 and so forth? EDIT: strptime is great. However, with datetime.strptime(date_str, "%a %b %d %H:%M:%S %z %Y") I get ValueError: 'z' is a bad d...

javascript :: date formatting?

Hi guys I am using an api with a json endpoint to grab some data. the api returns dates that look like: Date(1288205847730) (so a basic javascript date object) How do I convert that to Thu, 28 Oct That is the generalized question that I could work from. The actual question is I want to show Thu, 28 Oct format if there is more than 2...

Unexpected error about DateTime type

Hi everyone, I have a .aspx page for adding new product include the following field: ID, Name, DateTime, Price and it run well at localhost but when I publish it and up to the server, then I get the following error: System.Data.UpdateException: An error occurred while updating the entries. See the InnerException for details. ---> Sy...

PHP: Conversion failed when converting date and/or time from character string

I'm having trouble with this query. I have 2 date coming from textboxes (don't worry I've taken the necessary sql injection steps). They are used to query a MS SQL Server DATETIME field. I'm getting this error: Conversion failed when converting date and/or time from character string Here my code: //formatting my strings $from = str...

How to get a list of week days in a month?

In this other question it shows how to get all days of a month. I need the same thing, but I only want to list days of week (I want to exclude weekends). How can I get a list of days of a month excluding weekends? ...

Parsing a string to "year-month-day" format in C#

Hi Im using a webservice that needs a datetime in the following format "2010-12-24" I have the string to parse in the same "way" but as said, its a String. string myDate = "2010-12-24"; How can i parse it so that it gets the same format? Have tried using : DateTime.Parse(mystring); but this gives me a colon separated format. ...

AS3 Date problem

Any idea why the day is coming out wrong when the date is accurate? I'm debugging and I can see the date variables which are correct but the day is wrong. date Date (@9f14161) date 26 [0x1a] dateUTC 26 [0x1a] day 5 dayUTC 5 fullYear 2010 [0x7da] fullYearUTC 2010 [0x7da] hours 17 [0x11] hou...

How to parse dates in multiple formats using SimpleDateFormat

I am trying to parse some dates that are coming out of a document. It would appear users have entered these dates in a similar but not exact format. here are the formats: 9/09 9/2009 09/2009 9/1/2009 9-1-2009 What is the best way to go about trying to parse all of these? These seem to be the most common, but I guess what is hanging m...

Comparing dates in milliseconds

Say I have two date fields receiveDate and currentDate. I want to check if receiveDate was 5 days before currentDate. What I did was to convert the dates in milliseconds and then compare against 5. Is there a better way of doing so? If so, how and why mine is any less better? Thanks. Method I wrote - private static final double DAY_IN_...

Why can DateTime.MinValue not be serialized in timezones ahead of UTC?

I am experiencing issues with a WCF REST service. The wire object that I try to return has certain properties not set, resulting in DateTime.MinValue for properties of type DateTime. The service returns an empty document (with HTTP status 200 ???). When I try to call JSON serialization myself, the exception that is thrown is: Seriali...

PHP : How to get milisecond between two dateTime obj?

PHP : How to get milisecond between two dateTime obj? $date = new DateTime(); $date2 = new DateTime("1990-08-07 08:44"); I try to follow the comment below but I got an error $stime = new DateTime($startTime->format("d-m-Y H:i:s")); $etime = new DateTime($endTime->format("d-m-Y H:i:s")); $millisec = $etime->getTimestamp() - $stime->g...

CakePHP: Time helper to show age

Hi, I have a MySQL DATETIME field that holds the date of birth of a user. I want to use that date to display the age the user in years. Is there a method of the Time core helper to do this? Also, why when you add a DATETIME field to a form in Cake does it not let you select a date less than 1990? Thanks, Jonesy ...

If I try to compare 2 joda-time DateTime values in Scala I get java.lang.NoClassDefFoundError. How to fix this?

Here's an example: import org.scala_tools.time.Imports._ ... val dt1 : DateTime = new DateTime ("2010-09-01T12:00Z") val dt2 : DateTime = new DateTime ("2010-10-01T12:10Z") println (dt1 < dt2) // This is the Main.scala:48 line mentioned in the stack trace below ... If I compile and run it, I get java.lang.NoClassDefFoundError: s...

Mysql function to generate millisecond precision timestamp as a BIGINT(13)

I am aware that mysql does not support storing timestamp columns with millisecond precision. My question: is there a mysql function I could write that will output the current time as a BIGINT(13) to millisecond precision. For example, as now() outputs a timestamp: mysql> select now(); +---------------------+ | now() | +-...

How to format DateTime columns in DataGridView?

Hello, I'm using a DataGridView with object data binding to display information about logging entities in a system, retrieved via SOAP from a remote service. One of the columns is called "Last action" and means the last time the entity logged a message. It is a System.DateTime value. When I read the SOAP response (example below), he time...

How to test if a DateTime is between 2 days of week (DayOfWeek)

In C#, given an arbitrary set of DayOfWeek end points (like, DayOfWeek.Friday and DayOfWeek.Sunday) how would one test if an arbitrary date falls between those two days, inclusive? Example: // result == true; Oct 23, 2010 is a Saturday var result = InBetweenDaysInclusive(new DateTime(2010, 10, 23), D...

iPhone timeIntervalSinceDate not throwing error, or working

I'm trying to find the difference between two NSDates. This worked once and printed the difference, but has never worked again. I don't remember changing any thing after the one time it worked. Any ideas? Oh, and it doesn't throw an error, and if I comment out this snippet everything works. //----------- Touches Begin - (void)to...