datetime

Algorithm needed to calculate difference between two times

Hi, I have an hour selection drop down 0-23 and minutes selection drop down 0-59 for Start time and End time respectively (so four controls). I'm looking for an algorithm to calculate time difference using these four values. Since they're not stored in fancy date/time selection controls, I don't think I can use any standard date/time ...

formatting date string in cakephp

I'm new to cakephp, I've got a simple Users controller that corresponds to a users table. I have a created field in the table that I want to ouput on the view action using the niceShort() function. how do I use it in the view? Current code is: <p>Member since <?php echo $user['User']['created']?></p> thanks, Jonesy ...

C# Format String as Date

Hi I have a DetailsView with a TextBox bound to a DateTime column. The value of the column is presented in the format "dd/mm/yyyy hh:mm:ss". I need it to be displayed in the format "yyyy/mm/dd". I had though that the best way may be to format the string in the DataBound event. Problem is, I can't seem to find a way to format the string ...

MySQL Date format Question

How do i convert 06 Aug 2010 03:41:44 GMT+00:00 to mm/dd/yy time in mysql? I basically want to sort this SentDate column (the data is populated from an external source). I am ok to do this in c# also. ...

strtotime - always return NEXT [date here]

I'm trying to use the strtotime function in order to return the following date specified. For example: strtotime('thursday'); //Need to get NEXT Thurs, not today (assuming today is Th) Using next thursday would work in this case, but does not work with absolute dates, such as: strtotime('next aug 19'); //Should return 08-19-2011, but...

Between Date Literals

How do I make this work in SQL Server (2005)? The error message is 'Invalid column name' on the literals. SELECT tstamp, GVEA_Load_Net_MWH FROM DA.dbo.Oplog WHERE CAST(LEFT(tstamp,18) AS datetime) BETWEEN "01/01/2009 00:00:00" AND "01/01/2010 00:00:00" ...

Parsing a Date with Month name to C# DateTime

Hey Guys, I want to parse the following date format to a DateTime object in C#. 19 Aug 2010 17:48:35 GMT+00:00 How can I accomplish this? Thanks for your help. ...

Convert PHP Date to Time

How can I covert this PHP date string: Thu 19th Aug 2010 @ 7:52PM to this: 1282247549 Which is done by: gmdate("D jS M Y @ g:iA", $row['project_deadline']) The timestamp is from the database with the stored time() function ...

problem with simple parse routine

this problem is killing me, here is my code import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Converter { // 8/12/2010 12:20:34 PM static String DATE_FORMAT = "MM/dd/yyyy h:MM:ss aa"; // from object to xml public static String serializeNCCDate(Date d) { ...

How to sort by Date from MYSQL using PHP

I have a php page which allows a user to sort pieces of information by several factors. A new requirement is to sort by "all items which have been registered in the last 15 days". I store my dates in the MYSQL table as mm/dd/yyyy. The information is passed and picked up on the same page using the $_GET variable but I am unable for some...

How do you subtract Dates in Java?

My heart is bleeding internally after having to go so deep to subtract two dates to calculate the span in number of days: GregorianCalendar c1 = new GregorianCalendar(); GregorianCalendar c2 = new GregorianCalendar(); c1.set(2000, 1, 1); c2.set(2010,1, 1); long span = c2.getTimeInMillis() - c1.getTimeInMillis(); ...

Using Pivot in SQL Server to Display dates as days of the week

Hi, I have table that has a column of type DateTime, I would like to pivot on the datetime column so that the dates are displayed as columns (as days of the week Monday, Tuesday etc). So for example I have a table like this (can't remember how SQL Server displays full datetimes but you get the idea): BugNo | DateOpened | TimeSpent 12...

Is this a standard DateTime format?

I haven't seen this datetime format before: 2010-08-19T16:09:07.08 The nearest I have found in the msdn is represented by the "o" standard format string, but it's not quite the same. So what is this format? If it's standard can I reproduce it with a standard format string? Thanks, Phil ...

Removing data from returned information.

Hi Guys, I am making an SQL Query that brings back a list of files and their paths. They have different file paths and different file names ofc. The file names are dates and time in the form of YearMonthDayHourMinuteSeconds. What I need to do is take the filepath that thas the latest date and time, strip off everything except the dat...

retrieve current date and time in Codeigniter

Hi, How can I retrieve the current date and time within a view in Codeigniter? Thanks. EDIT : What I'm trying to do is to subtract the current date/time from posted date/time and display it as "posted x days ago" ...

How to print unsigned int value as a time string in C

I need to print this value as a time string to Mon 16-Aug-2010 06:24 format or something similar. unsigned int t = 1281920090; ...

Return Array of Months Between and Inclusive of Start and End Dates

I have two dates - a start date and an end date. I need to return an array of months ('Y-m' format) which includes every month between start and end date, as well as the months that those dates are in. I've tried: $start = strtotime('2010-08-20'); $end = strtotime('2010-09-15'); $month = $start; while($month <= $end) { $months[] = d...

the code does not add 3hrs to the time why?

Literal four = new Literal(); string timeanddate; timeanddate = DateTime.UtcNow.ToString(); DateTime dt = new DateTime(); dt = Convert.ToDateTime(timeanddate); dt.AddHours(3); four.Text = "3hr added and this gives>> " + dt.ToString(); form1.Controls.Add(four); it should add 3 to hrs but doesnot, its lik...

how to change time format to 24hrs? in c#

Literal four = new Literal(); string timeanddate; timeanddate = DateTime.UtcNow.ToString(); DateTime dt = new DateTime(); DateTime dt_calc = new DateTime(); dt = Convert.ToDateTime(timeanddate); dt_calc = dt.AddHours(3); four.Text = "3hr added and this gives>> " + dt_calc.ToString(); form1.Controls.A...

datetime in c# how to change the default returned value to 24hrs?

yes what returned can be formatted using HH to display value in 24hrs, but is there a way to make this the default returned value.? ...