Showing posts with label DateTime. Show all posts
Showing posts with label DateTime. Show all posts

Friday, December 5, 2014

How to combine date from one field with time from another field - MS SQL Server

SELECT CAST(MyDate AS DATETIME) + CAST(MyTime AS DATETIME) AS CombinedDateTime
 
--OR
--if date part is missing and you want to format time in asp net
SELECT CAST(GETDATE() AS DATE) + CAST(MyTime AS DATETIME) AS CombinedDateTime

Friday, December 3, 2010

Parsing UK Date in javascript

To reach a date object with UK format in javascript has no straight road. Well you can use split map to reach there.
Consider this example
var ukDate = new Date("01/12/2011");
well for javascript it is
Wed Jan 12 2011 00:00:00
but we can use the split() object to first separate the date using “/” as separator and then create the Date Object
Consider this example
var ukDate="01/12/2011";
var dateArray=ukDate.split("/");
var newDate=new Date(dateArray[2], dateArray[1]-1,dateArray[0]);
 
not output will be
Thu Dec 01 2011
and your are done