Timefield Problem(am/pm)

  1. #1

    Timefield Problem(am/pm)

    Hi all.....

    i have a time field in window..i have written a code in Page load(.cs file) to display the current time(means whenever user log in ,
    it should display the system time or log in time(am/pm)).. It is displaying the right time, i logged in at 9:00 AM but it is displaying
    9:00 PM.. plz solve the problem..
    
    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
       
        <ext:ScriptManager ID="knkldjf" runat="server" InitScriptMode="Inline" CleanResourceUrl="false" ></ext:ScriptManager>
        
        <ext:Window ID="windowtime" runat="server" Width="400" Height="100" Center&#111;nload="true">
         <Body>
         
         
          <ext:TimeField ID="tmTime" runat="server" Format="hh:mm tt"  />
              
     <%--<ext:TextField ID="txtTime" runat="server" Width="200" />--%>
         
         </Body>
        
        </ext:Window>
        
        
        </form>
    </body>
    </html>
    
    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using Coolite.Ext.Web;
    
    
    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
            
    
            // txtTime.Text = Convert.ToString(DateTime.;
           tmTime.SelectedValue = Convert.ToString(DateTime.Now.TimeOfDay);
            //ddlFromValidTime.SelectedTime = DateTime.Now.TimeOfDay
    
           
    
        }
    }
  2. #2

    RE: Timefield Problem(am/pm)

    Hi,

    Unfortunately I was not able to reproduce the problem.


    You should be able to set the .SelectedTime property directly with a TimsSpan object and no need to convert to a string.


    Example


    this.TimeField1.SelectedTime = DateTime.Now.TimeOfDay;

    Geoffrey McGill
    Founder
  3. #3

    RE: Timefield Problem(am/pm)

    ya tried its working..i logged in at 9:00am but it is showing 9:00pm..why?
  4. #4

    RE: Timefield Problem(am/pm)

    kiran malgi (6/22/2010) ya tried its working..i logged in at 9:00am but it is showing 9:00pm..why?
    I don't know why this is happening. Can you provide a code sample (or sample visual studio project) which demonstrates how to reproduce the problem?


    Geoffrey McGill
    Founder
  5. #5

    RE: Timefield Problem(am/pm)

    
    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
       
        <ext:ScriptManager ID="sm" runat="server" InitScriptMode="Inline" CleanResourceUrl="false" ></ext:ScriptManager>
        
        <ext:Window ID="windowtime" runat="server" Width="400" Height="100" Center&#111;nload="true">
         <Body>
         
         
          <ext:TimeField ID="tmTime" runat="server" Format="hh:mm:s tt"  />
    
     </Body>
        
        </ext:Window>
        
        
        </form>
    </body>
    </html>



    
    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using Coolite.Ext.Web;
    
    
    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
    
            this.tmTime.SelectedTime = DateTime.Now.TimeOfDay;
       
          
           
    
        }
    }

Similar Threads

  1. TimeField in Gridpanel (RowEditor) problem
    By cmujica in forum 1.x Help
    Replies: 1
    Last Post: Mar 22, 2012, 10:46 AM
  2. [CLOSED] TimeField - validation problem
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2011, 11:47 PM
  3. TimeField and en-US culture problem
    By Ealirene in forum 1.x Help
    Replies: 1
    Last Post: Mar 21, 2011, 8:00 AM
  4. [CLOSED] [1.0] TimeField Problem?
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 15, 2010, 2:43 PM
  5. TimeField problem how to display the time
    By heysol in forum 1.x Help
    Replies: 0
    Last Post: Nov 06, 2009, 8:52 PM

Posting Permissions