Dubli Join Us

Search About New Technology and Bug

Loading...

Tuesday, July 1, 2014

For Localize Datetime in Windows Application

  private void Form1_Load(object sender, EventArgs e)
        {

            // Creating a Global culture specific to our application.
            System.Globalization.CultureInfo cultureInfo =new System.Globalization.CultureInfo("en-US");
            // Creating the DateTime Information specific to our application.
            System.Globalization.DateTimeFormatInfo dateTimeInfo =
                new System.Globalization.DateTimeFormatInfo();
            // Defining various date and time formats.
            dateTimeInfo.DateSeparator = "/";
            dateTimeInfo.LongDatePattern = "dd-MMM-yyyy";
            dateTimeInfo.ShortDatePattern = "dd/MM/yyyy";
            dateTimeInfo.LongTimePattern = "hh:mm:ss tt";
            dateTimeInfo.ShortTimePattern = "hh:mm tt";
            // Setting application wide date time format.
            cultureInfo.DateTimeFormat = dateTimeInfo;
            // Assigning our custom Culture to the application.
            Application.CurrentCulture = cultureInfo;
            Thread.CurrentThread.CurrentCulture = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;

           
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
           

            label1.Text = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy" ,new CultureInfo("en-US"), DateTimeStyles.None).ToString();

            string dt = DateTime.ParseExact(dateTimePicker1.Value.Date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None).ToString("MM/dd/yyyy");
        }

Saturday, June 28, 2014

Good Css for HTML Table

<style type="text/css" >



/* Table 3 Style */
#tbl{
    font-family:Arial;
    font-size: 12px;
    font-style: normal;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: -1px;
    line-height: 1.7em;
    text-align:center;
    border-collapse:collapse;
}
#tbl thead th{
    padding:6px 10px;
    text-transform:uppercase;
    color:#444;
    font-weight:bold;
    text-shadow:1px 1px 1px #fff;
    border-bottom:5px solid #444;
}
#tbl thead th:empty{
    background:transparent;
    border:none;
}
#tbl thead :nth-child(2),
#tbl tfoot :nth-child(2){
    background-color: #7FD2FF;
}
#tbl tfoot :nth-child(2){
    -moz-border-radius:0px 0px 0px 5px;
    -webkit-border-bottom-left-radius:5px;
    border-bottom-left-radius:5px;
}
#tbl thead :nth-child(2){
    -moz-border-radius:5px 0px 0px 0px;
    -webkit-border-top-left-radius:5px;
    border-top-left-radius:5px;
}
#tbl thead :nth-child(3),
#tbl tfoot :nth-child(3){
    background-color: #45A8DF;
}
#tbl thead :nth-child(4),
#tbl tfoot :nth-child(4){
    background-color: #2388BF;
}
#tbl thead :nth-child(5),
#tbl tfoot :nth-child(5){
    background-color: #096A9F;
}
#tbl thead :nth-child(5){
    -moz-border-radius:0px 5px 0px 0px;
    -webkit-border-top-right-radius:5px;
    border-top-right-radius:5px;
}
#tbl tfoot :nth-child(5){
    -moz-border-radius:0px 0px 5px 0px;
    -webkit-border-bottom-right-radius:5px;
    border-bottom-right-radius:5px;
}
#tbl tfoot td{
    font-size:14px;
    font-weight:bold;
    padding:8px 0px;
    text-shadow:1px 1px 1px #fff;
}
#tbl tbody td{
    padding:8px;
}
#tbl tbody tr:nth-child(4) td{
    font-size:14px;
    font-weight:bold;
}
#tbl tbody td:nth-child(even){
    background-color:#444;
    color:#444;
    border-bottom:1px solid #444;
    background:-webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.39, rgb(189,189,189)),
        color-stop(0.7, rgb(224,224,224))
        );
    background:-moz-linear-gradient(
        center bottom,
        rgb(189,189,189) 39%,
        rgb(224,224,224) 70%
        );
    text-shadow:1px 1px 1px #fff;
}
#tbl tbody td:nth-child(odd){
    background-color:#555;
    color:#f0f0f0;
    border-bottom:1px solid #444;
    background:-webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.39, rgb(85,85,85)),
        color-stop(0.7, rgb(105,105,105))
        );
    background:-moz-linear-gradient(
        center bottom,
        rgb(85,85,85) 39%,
        rgb(105,105,105) 70%
        );
    text-shadow:1px 1px 1px #000;
}
#tbl tbody td:nth-last-child(1){
    border-right:1px solid #222;
}
#tbl tbody th{
    color:#696969;
    text-align:right;
    padding:0px 8px;
    border-right:1px solid #aaa;
}
img {

   display: block;
  -moz-box-sizing: border-box;

  background: url("images/check0.png");
  background-repeat:no-repeat;
  width: 70px; /* Width of new image */
  height: 50px; /* Height of new image */
  padding-left: 180px; /* Equal to width of new image */
   

}


</style>

Convert value from string to date format in SQL Server 2008

Dim ydate = "16/12/2007"
Dim edate As Date = Date.ParseExact(ydate, "dd/MM/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)