Thursday, October 30, 2014

Date Format Based On Stored Procedure



Date
var newdate = DateTime.Now.AddDays(+16).ToString("dd/MM/yyyy hh:mm t\\M", new CultureInfo("en-US"));
var newdate = DateTime.Now.AddDays(+16).ToString("g", new CultureInfo("en-US"));
Based On Id paricular Record
context.Users.FirstOrDefault(x => x.Id == job.UserId);
select
context.users.take(10);


Date time format change
string input = "2012-06-28T08:26:57Z";
var dt = DateTime.Parse(input);
string output = dt.ToString(@"MM/dd/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);=
create procedure JobAlertsBasedOnDateAfter5Days
as
begin
select * from dbo.[User] where CreatedDateTime=dateadd(day,datediff(day,5,CAST(CURRENT_TIMESTAMP AS DATE)),0) and (IsDeleted =0 or IsDeleted is null)
end
go

select * from dbo.[User] where id=3253
select dateadd(day,datediff(day,5,CAST(CURRENT_TIMESTAMP AS DATE)),0)

update dbo.[user] set CreatedDateTime='2014-10-25' where Id=3253

select * from Job where CreatedDateTime=dateadd(day,datediff(day,14,CAST(CURRENT_TIMESTAMP AS DATE)),0) and ((IsDeleted =0 or IsDeleted is null) and(IsRssJob=0 or IsRssJob is null))

create procedure JobAlertsBasedOnDateRememberEmail
as
begin
select * from dbo.[User] where (LastLoginTime=dateadd(day,datediff(day,29,CAST(CURRENT_TIMESTAMP AS DATE)),0) or LastLoginTime=dateadd(day,datediff(day,43,CAST(CURRENT_TIMESTAMP AS DATE)),0)) and IsCompany is null and IsAdmin is null
end
go

select dateadd(day,datediff(day,29,CAST(CURRENT_TIMESTAMP AS DATE)),0)


select * from dbo.[User] Where Id=3253

update dbo.[User] set LastLoginTime='2014-10-01' where Id=3253