CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of date
C#
//using System.Globalization;
CultureInfo culture = new CultureInfo("en-AU");
DateTime week_start = Convert.ToDateTime("27/07/2011", culture);
by Egli   August 01, 2011 @ 12:27am
98 Views
no comments
 
C#
// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
 
String.Format("{0:y yy yyy yyyy}", dt);  // "8 08 008 2008"   year
String.Format("{0:M MM MMM MMMM}", dt);  // "3 03 Mar March"  month
String.Format("{0:d dd ddd dddd}", dt);  // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}",     dt);  // "4 04 16 16"      hour 12/24
String.Format("{0:m mm}",          dt);  // "5 05"            minute
String.Format("{0:s ss}",          dt);  // "7 07"            second
String.Format("{0:f ff fff ffff}", dt);  // "1 12 123 1230"   sec.fraction
by Egli   July 24, 2011 @ 10:54pm
69 Views
no comments
 
C++
/*
WRITE A PROGRAM TO CALCULATE NUMBERS OF DAYS BETWEEN  1 JAN 1900 AND USER ENTERED DATE.
 
 
 
NOTE: 1900 was not leap year, after that every 4 year there is leap year 1904,1908, 1912 ...) upto 2096 .
now again 3000 is not leap year and so on after 3000 (3004, 3008, 30012  ) is leap year .
u can calulate that .
in case  u know about leap year.
http://kalender-365.de/leap-years.php
by niraj   April 09, 2011 @ 12:16pm
95 Views
no comments
 
function checkEmail(inputvalue){    
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    if(pattern.test(inputvalue)){         
        return true;   
    }else{   
        return false; 
    }
}
by jaredmroberts   January 28, 2011 @ 2:52pm
172 Views
no comments
 
C#
Object:
            [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")] 
View:
                        <%= Html.EditorFor(model => model.suspension.DateBegin)%>
by cn982mj   December 16, 2010 @ 7:24am
196 Views
no comments
 
C#
public DateTime getIndianStandardTime()
{
 TimeZoneInfo IND_ZONE=TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
 return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, IND_ZONE);
}
by pandiyachendur   July 16, 2010 @ 2:17am
240 Views
no comments
 
C#
public static IEnumerable<ValidationResult> Validate(object component)
{
    return from descriptor in TypeDescriptor.GetProperties(component).Cast<PropertyDescriptor>()
            from validation in descriptor.Attributes.OfType<System.ComponentModel.DataAnnotations.ValidationAttribute>()
            where !validation.IsValid(descriptor.GetValue(component))
            select new ValidationResult(
                validation.ErrorMessage ?? string.Format(CultureInfo.CurrentUICulture, "{0} validation failed.",     
                validation.GetType().Name),
                new[] { descriptor.Name });
}
by Arjan   June 26, 2010 @ 10:28am
233 Views
no comments
 
NSData *soundData = [NSData dataWithContentsOfURL:url];
AVAudioPlayer  *avPlayer = [[AVAudioPlayer alloc] initWithData:soundData error: nil];
[avPlayer play];
by Yuzhen Situ   June 03, 2010 @ 1:28am
479 Views
no comments
 
LPARAMETERS cfile, olog
 
LOCAL citems, cparts, citem, cpart, citemprev, calias, cfilen, cfilennew, nrec, nrecd, nafld, nprevsel, lcsubject, lcbody, lcbodyitems, lcbodyparts
 
ccr= CHR(13)+CHR(10)
 
nprevsel = SELECT()
cfile = LOWER(cfile)
 
sns = ALLTRIM(SYS(2))
by vlad tamas   May 25, 2010 @ 6:57am
199 Views
no comments
 
<Extension()> _
Public Function TimeIntervals(ByVal DateNavigator As DateNavigator) As TimeIntervalCollection
    Dim dc As List(Of DateTime) = (From x In DateNavigator.Selection Order By CDate(x) Select CDate(x)).ToList
    TimeIntervals = New TimeIntervalCollection
    Dim startdt As DateTime = DateTime.MinValue, enddt As DateTime = DateTime.MinValue
    For Each dt As DateTime In dc
        If startdt = DateTime.MinValue Then startdt = dt
        If enddt > DateTime.MinValue _
        AndAlso enddt.AddDays(1) < dt Then
            TimeIntervals.Add(New TimeInterval(startdt, enddt.Subtract(startdt)))
by Thom Lamb   April 21, 2010 @ 9:21am
354 Views
no comments
 
/// <reference path="jquery.js" />
/*
ServiceProxy.js  
Version 0.981 - 4/5/11
 
(c) 2008-2011 Rick Strahl, West Wind Technologies 
www.west-wind.com
 
Load json2.js before this library
http://github.com/douglascrockford/JSON-js/blob/master/json2.js
by Rick Strahl   April 12, 2010 @ 6:40pm
Tags: JSON, Ajax, Date, ASMX, WCF
3763 Views
no comments
 
//UpdatePanel BusyIndicator
    // gif:     http://www.ajaxload.info
    // html:      <span id="busyIndicator" class="floatRight"></span>
    // #busyIndicator        {width:16px; height:16px;}
    // .busy            {background:transparent url(../Images/ajax-loader.gif) no-repeat scroll left top;}
    
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
by Arjan   April 03, 2010 @ 4:21am
294 Views
no comments
 
SQL
'1/1/2000 1:30 AM' != '1/1/2000 1:31 AM'
 
-- ///
 
DECLARE @x datetime
SET @x = GETDATE()
SET @x = CONVERT(varchar, @x, 101)
 
-- ///
by Jerry Nixon   March 05, 2010 @ 8:53am
Tags: SQL, DateTime
466 Views
no comments
 
SQL
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) 
select convert(varchar(10),getdate(),121)
CONVERT(VARCHAR,start_dttm,111)
by Stefan Sandström   February 23, 2010 @ 12:42am
Tags: sql, date
254 Views
no comments
 
C#
// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
 
String.Format("{0:y yy yyy yyyy}", dt);  // "8 08 008 2008"   year
String.Format("{0:M MM MMM MMMM}", dt);  // "3 03 Mar March"  month
String.Format("{0:d dd ddd dddd}", dt);  // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}",     dt);  // "4 04 16 16"      hour 12/24
String.Format("{0:m mm}",          dt);  // "5 05"            minute
String.Format("{0:s ss}",          dt);  // "7 07"            second
String.Format("{0:f ff fff ffff}", dt);  // "1 12 123 1230"   sec.fraction
by KMS   December 23, 2009 @ 9:17am
Tags: DateTime
412 Views
no comments
 
C#
System.Threading.Thread.CurrentThread.CurrentCulture = new FarsiLibrary.Utils.PersianCultureInfo();
System.Threading.Thread.CurrentThread.CurrentUICulture = new FarsiLibrary.Utils.PersianCultureInfo();
fXDatePicker1.FlowDirection = FlowDirection.RightToLeft;
 
by afsharm   August 25, 2009 @ 6:16am
574 Views
1 comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate