Essential SQL Server Date, Time and DateTime Functions

Standard Date, Time & TimeSpan Functions

function DateOnly(@DateTime DateTime)
— Returns @DateTime at midnight; i.e., it removes the time portion of a DateTime value.
returns datetime

create function Date(@Year int, @Month int, @Day int)
— returns a datetime value for the specified year, month and day
— Thank you to Michael Valentine Jones for this formula (see comments).
returns datetime

create function Time(@Hour int, @Minute int, @Second int)
— Returns a datetime value for the specified time at the “base” date (1/1/1900)
— Many thanks to MVJ for providing this formula (see comments).
returns datetime

create function TimeOnly(@DateTime DateTime)
— returns only the time portion of a DateTime, at the “base” date (1/1/1900)
returns datetime

create function DateTime(@Year int, @Month int, @Day int, @Hour int, @Minute int, @Second int)
— returns a dateTime value for the date and time specified.
returns datetime

create function TimeSpan(@Days int, @Hours int, @Minutes int, @Seconds int)
— returns a datetime the specified # of days/hours/minutes/seconds from the “base” date of 1/1/1900 (a “TimeSpan”)
returns datetime

create function TimeSpanUnits(@Unit char(1), @TimeSpan datetime)
— returns the # of units specified in the TimeSpan.
— The Unit parameter can be: “d” = days, “h” = hours, “m” = minutes, “s” = seconds
returns int

For More Details: Essential SQL Server Date, Time and DateTime Functions

see also:

IronPython Studio – Home

image 

Introduction

IronPython Studio is a free full IDE (Integrated Development Environment) for the Python programming language. It is based on the existing IronPython example that is included in the VS SDK.
IronPython Studio is based on the Visual Studio 2008 Shell runtime (royalty free) and can be installed without requiring any version of Visual Studio.

IronPython Studio – Home

Extract frames from video files – The Code Project – Multimedia

 

Introduction

This class contains methods to use the IMediaDet interface, that can be found in Microsoft DirectShow.
The Media Detector object, among other things, can be used to extract still pictures from several file formats including .avi, .wmv and some .mpeg files. This class exposes the GetFrameFromVideo, GetVideoSize and SaveFrameFromVideo methods that can be used from any .net application. The class also takes care of translating HRESULTs returned from the functions to meaningful .net exceptions.

Using the code

Just add a reference to JockerSoft.Media.dll in your project (or include the source code). Remember also to distribute Interop.DexterLib.dll  All the methods are static, so to use them just do something like

try
{
    this.pictureBox1.Image = FrameGrabber.GetFrameFromVideo(strVideoFile, 0.2d);
}
catch (InvalidVideoFileException ex)
{
    MessageBox.Show(ex.Message, "Extraction failed");
}
catch (StackOverflowException)
{
    MessageBox.Show("The target image size is too big", "Extraction failed");
}

or

try
{
    FrameGrabber.SaveFrameFromVideo(strVideoFile, 0.2d, strBitmapFile);
}
catch (InvalidVideoFileException ex)
{
    MessageBox.Show(ex.Message, "Extraction failed");
}

Via Extract frames from video files – The Code Project – Multimedia

Read/Write App.Config

In .NET 2.0+ and with the help of Visual Studio Generated Settings.settings, you can do the following:

image

Load your settings programmatically:

Settings set = Settings.Default;

Read from your settings:

string str = set.testSetting;

Write to your settings:

set.testSetting = “xyz”;
set.Save();

Very Easy

LINQ, C# Rolls

 

What’s New in C# 

Community Web Sites and Downloads

Source from : Charlie Calvert’s Community Blog

del.icio.us Tags: ,