Posts Tagged ‘date’

  • Date Time string formatting in ASP.NET
    With the following code you can format a DateTime within a Databind. <%# DateTime.Parse(Eval("DateModified").ToString()).ToString("MM-dd-yyyy")%> Some more format specifiers that can change format of datetime objects the way it is required. Format specifier Name d Short date pattern D Long date pattern t Short time pattern T Long...
    by Nauman at December 24th, 2009 at 04:12 am
  • Calculating difference of dates in Oracle
    How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats: Here are some examples, these can also be amended for user convenience: SQL> SELECT floor(((date1-date2)*24*60*60)/3600) 2 || ' HOURS...
    by Nauman at November 18th, 2009 at 09:11 am
  • Find week start/end given week number
    I have a table with some dated records. I wanted to do some weekly reports on this data. MySQL has a nifty function dubbed WEEK() which will return a week number. It allows you to break your data into week long intervals very easily. For example, the following query will tell me how many records came in each week: SELECT COUNT(*), WEEK(mydate) FROM mytable GROUP BY WEEK(mydate); The...
    by Nauman at November 3rd, 2009 at 07:11 am
  • How To Calculate the Number of Week Days Between two Dates
    If the start date and end date are both week days, then the total number of week days in between is simply: (total difference in days) – (total difference in weeks) * 2 DateDiff(dd, @start, @end) – DateDiff(ww, @start, @end)*2 … since the DateDiff() function with weeks returns the number of week "boundaries" that are crossed; i.e., the number...
    by Nauman at November 1st, 2009 at 09:11 am