help me frenz

Last post 01-14-2008 4:20 AM by geosync. 8 replies.

Sort Posts:

  • help me frenz

    01-14-2008, 2:07 AM

    ive used the date picker as suggested at the forum topics, but when i view in browser the date time shows the correct date but the time is always 12:00:00 AM, what should i do? here, i put some of the codes dat i used

     

    <tr>

    <td>

    Publish Start Date:</td>

    <td>

    <!-- Start of Date Picker -->

    <table cellspacing="0" cellpadding="0" style="border-collapse: collapse" enableviewstate="true"

    onmousedown='javascript:Calendar.setup({

    inputField : "dpPublishStartDate", // id of the input field

    displayArea : "dpPublishStartDate_show", // ID of the span where the date is to be shown

    firstDay : 1, //specifies the first day of week

    ifFormat : "%m/%d/%Y", // format of the input field

    daFormat : "%d %b %Y", // format of the displayed date

    button : "dpPublishStartDate_Img", // trigger for the calendar (button ID)

    align : "Tl", // alignment (defaults to "Bl")

    singleClick : true

    });'>

    <tr>

    <td>

    <input type="text" id="dpPublishStartDate_show" name="dpPublishStartDate_show" runat="server"

    class="fieldText" readonly="readonly" size="15" value="-- not selected --" />&nbsp;

    <input type="hidden" name="dpPublishStartDate" id="dpPublishStartDate" runat="server" readonly="1" />

    </td>

    <td>

    <img src="image/button/calendar_large.gif" id="dpPublishStartDate_Img" runat="server"

    style="cursor: pointer;" title="Date selector" onmouseover="this.style.background='transparent';"

    onmouseout="this.style.background=''" />

    </td>

    </tr>

     

    help me frenzTongue Tied

  • Re: help me frenz

    01-14-2008, 3:42 AM
    Answer
    • Star
      8,329 point Star
    • farazsk11
    • Member since 02-22-2006, 8:10 PM
    • Sharjah, UAE
    • Posts 1,382

    Hi,

    are you suppose to fetch the date only or the date and time both. Well what i belive is the date control is returning the correct date and it is showing you the default time. if you want to avoid the time then you can clip of the date part only.

    Thanks and best regards,

    Faraz Shah Khan
    MCP, MCAD.Net, MCSD.Net, MCTS-Win/Web, MCPD-Web
    Blog
  • Re: help me frenz

    01-14-2008, 3:47 AM
    Answer
    • Contributor
      2,349 point Contributor
    • geosync
    • Member since 03-26-2006, 4:44 PM
    • Boston, MA, USA
    • Posts 741

    Hey, here's some background about dates and times:

    Dates are stored as type DateTime.  This means you always get a Time component with a Date. 

    Time is represented as the number of milliseconds since midnight of the date specified.

    Your time of 12:00:00 AM is midnight, which is represented as 0 in the DateTime instance.

    What this seems to indicate is the Date Picker returns a specific Date but not a specific Time, simply assigning the Time component as 0 (midnight).

    You cannot dispose of the Time component.  It's always considered to be present, even if it's just a 0 representing midnight.

    The way to display type DateTime as only a date, or only a time, or a date and a time combination is through formatting.

     

    Do you want a Time component?  Maybe a different Date Picker is more suitable.

    Don't want a Time component?  You would need to apply some formatting to hide the Time component.

     

    Not sure these are the answers you're looking for.  But I think they explain what's going on.

    HTH 

    ~ Timing is Everything! ~
  • Re: help me frenz

    01-14-2008, 4:01 AM

    thanx bro,so if i want to avoid the time then i think i should change in mySQL from DATETIME to DATE am i rite?

  • Re: help me frenz

    01-14-2008, 4:09 AM

    dear geosync, thanx 4 d info..so if i want to store in DATETIME so i have to get another date picker that include the DATETIME rite?

  • Re: help me frenz

    01-14-2008, 4:16 AM
    • Contributor
      2,349 point Contributor
    • geosync
    • Member since 03-26-2006, 4:44 PM
    • Boston, MA, USA
    • Posts 741

    truebornkiller86:

    dear geosync, thanx 4 d info..so if i want to store in DATETIME so i have to get another date picker that include the DATETIME rite?

    Yes, I believe that is true. 

    ~ Timing is Everything! ~
  • Re: help me frenz

    01-14-2008, 4:18 AM

    owh ok, thanx geosync

  • Re: help me frenz

    01-14-2008, 4:19 AM
    • Contributor
      2,349 point Contributor
    • geosync
    • Member since 03-26-2006, 4:44 PM
    • Boston, MA, USA
    • Posts 741

    truebornkiller86:

    thanx bro,so if i want to avoid the time then i think i should change in mySQL from DATETIME to DATE am i rite?

     

     

    I don't know mySQL very well, nor the date picker your using; but that sounds right.

    ~ Timing is Everything! ~
  • Re: help me frenz

    01-14-2008, 4:20 AM
    • Contributor
      2,349 point Contributor
    • geosync
    • Member since 03-26-2006, 4:44 PM
    • Boston, MA, USA
    • Posts 741

    truebornkiller86:

    owh ok, thanx geosync

     

     

    Any time!  good luck!

    ~ Timing is Everything! ~
Page 1 of 1 (9 items)