Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    USA
    Posts
    2

    Unanswered: Is are a way to convert the SQL datetime to MFC CTime

    Hi
    Here is the time in SQL : 2/21/2003 12:00:00 PM (DataType :datetime)

    How can i convert this into CTime .the MFC class
    Help inthis regard is appreciated,
    Thanks in Advance

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    A datetime is not that format. It is a decimal number - that is just the way it is converted for display.

    What format do you need it in to put into a CTime.

  3. #3
    Join Date
    Feb 2003
    Location
    USA
    Posts
    2

    Arrow How to Get Hour,Minute,Day

    Thanks 'nigelrivett' for replying me
    Yes...I reading the date(datetime) from the Data Base as the String..I want Month,Year,Date,Hour and Minute to build the Time for my application.

    i like to build the CTime as below:

    CTime Ts(nYear,nMonth,nDate,nHour,nMinute,nSecond,o);

    So please tell me how get the Hour,minute,Day,Year from the Data Base.

    Thanks in advance,
    Sirish

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    try:
    select getdate() as 'Original Date'
    , datepart(yy,getdate()) as 'Year'
    , datepart(mm,getdate()) as 'Month'
    , datepart(dd,getdate()) as 'Day'
    , datepart(hh,getdate()) as 'Hour'
    , datepart(mi,getdate()) as 'Minute'
    , datepart(ss,getdate()) as 'Second'
    , datepart(ms,getdate()) as 'Millisecond'
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •