dateformat

perl- help formatting a timestamp

I am reading in log data with the following time stamp format: Sat Aug 07 04:42:21 2010 I want to convert it to something like this: 20100807044221 What is the best way to do this in perl? Thanks. ...

Custom string formats of TimeSpan

I want to format TimeSpans in C# in this way: xxx day(s) yyy hours(s) zzz minute(s) Conditions: Extra seconds should be truncated day(s) is the largest unit I want. I want 34 days to appear as 34 days rather than 1 month 4 days etc. If timespan is less than one day, I dont want the day part to show up. Likewise if span is less than 1...

How do you format a date range in Java?

I have two dates - a start and an end. I'd like to format them so that if the months match, they collapse to something like "20-23 AUG" and still format correctly if they break over the end of the month, like "20 SEP - 1 OCT". Are there any libraries out there for accomplishing this, or would I have to hand code rules for displaying ra...

Compare dates in DataView.RowFilter ?

I am scratching my head over something rather stupid yet apparently difficult. DataView dvFormula = dsFormula.Tables[0].DefaultView; dvFormula.RowFilter = "'" + startDate.ToString("yyyyMMdd") + "' < EndDate OR EndDate = '19000101'"; dvFormula.Sort = "FromDate ASC"; The result is this: Cannot perform '<' operation on System.String ...

convert string to date(dd/MM/yyyyy) format in c#

i have a query string with format MM/DD/YYYY I am using it in c# like DateTime d = Request.QueryString["dateTime"].toString(); its giving me a lot of error saying the date time format is not recognized. If i manually change the datetime in browser address bar (query string) to dd/mm/yyyy then the program just works fine. I cannot c...

DateFormat Error.

Under new Date(); it has an error. I want to place it as a file name. Date date = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("ddMMyyyyHHmmSS"); filename = dateFormat.format(date).concat(".jpg"); ...

Convert date format to mysql time stamp

I have some dates that are returned as the following string: Fri, 13 Aug 2010 01:48:47 -0400 (EDT) I'd like to parse this and turn it into a datetime stamp, so like this: 2010-08-13 01:48:47 Any help would be awesome... thank you! ...

converting a DetailsView TemplateField cell value to short date string

I have a detailsView whose date values in a cell are currently being displayed in longDateFormat, i want to convert all date values in this DetailsView to short date. For example, instead of 6/1/2010 12:00:00 AM, i want to display just 6/1/2010 For a Gridview, i can achieve that by the code blow Protected Sub DetailsView4_DataBound(...

How to format a date with slashes in C#

When i write a date in C# by using DateTime.Now.ToString("yyyy/MM/dd") then it returns 2010-09-10, but I need 2010/09/10. How do I make it output slashes? ...

How can I convert this date in Java?

I want to convert: 2010-03-15T16:34:46Z into something like "5 hours ago" How can I do this in Java? ...

How can I convert this string to a standard date in java?

Earlier I posted the following question: http://stackoverflow.com/questions/3791984/how-can-i-convert-this-date-in-java But now I would like to know how I can convert this string into a date/time. 2010-03-15T16:34:46Z For example: 03/15/10 UPDATED: String pattern = "MM/dd/yy 'at' HH:mm"; Date date = new Date(); ...

php date format

hi, i wanna convert date 24/09/2010 in format dd/mm/yyyy to 2010-09-24 in format yyyy-mm-dd when i tried this: date("Y-m-d",strtotime("09/24/2010")); it works. but when i tried this: date("Y-m-d",strtotime("24/09/2010")); it return as 1970-01-01 any idea why?? ...

convert date from "2009-12 Dec" format to "31-DEC-2009"

'2009-12 Dec' should be converted to '31-DEC-2009' '2010-09 Sep' should be converted to '30-SEP-2010' '2010-02 Feb' should be converted to '28-FEB-2010' '2008-02 Feb' should be converted to '29-FEB-2008' The values 2009-12 Dec, 2008-02 Feb will be displayed to the User in a drop down. The User have no option to select the DAY. The use...

Why is my ASP.Net Date Format Changing Erratically?

I have an asp.net 4.0 Formview bound to a SqlDataSource, hosted on IIS7, and I'm displaying a date for editing like this: <input id="OrderDateTextBox" type="text" value='<%# Eval("OrderDate", "{0:d}") %>' /> This generally works as expected, but occasionally the date format displays d/m/y instead of m/d/y. When this happens, a page r...

String to datetime

Hello, I saved a datetime.datetime.now() as a string. Now I have a string value, i.e. 2010-10-08 14:26:01.220000 How can I convert this string to Oct 8th 2010 ? Thanks ...

Java DateFormat.

Hi there, I know Java Date Time is not a good way to go forward but I was just curious as to what's happening: Why does the following line: DateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.US) not produce any errors and the following lines do: DateFormat df = new SimpleDateFormat("DD-MMM-YYYY", Locale.US) DateFormat df = n...

How to define the date format?

I have the int number 2455449 and I know that represents the date 09/09/2010. How can I define the date format wihch is used? I need to generate a new date in this format. It will be used for http requests. I suppose that is Julian but I'm not sure. I tried to convert this number to the date but it didn't return the right date of 09...

Why does this PrettyTime custom tag produce 11 lines of blank text before the "pretty" date in the HTML output?

<%@ tag language="java" pageEncoding="utf-8" isELIgnored="false" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>...

"Java DateFormat is not threadsafe" what does this leads to?

Everybody cautions regarding Java DateFormat not being thread safe and I understand the concept theoretically. But I'm not able to visualize what actual issues we can face due to this - say, I've a DateFormat field in class and the same is used in different methods in the class(formatting dates) in a multi-threaded environment. Will thi...