SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Sep 2002
    Location
    ONDlodnol
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Converting DateTime

    I have a Recorded Class object that was made from an OLE object. I'm using ANYTYPE date type because it is defined as a value for the object.
    ( EX..... aYear, aDay, aMonth)

    By using GetDateTime() from the system how can I compare that to the class defined object and use MatchStr() or some other method to verify that it matches the system time and date?
    Goodness is a part of life just like the Devil

  2. #2
    Senior Member
    Join Date
    Sep 2002
    Location
    ONDlodnol
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    yeah, but when I complie the script it tells me Mismatch data type.
    Goodness is a part of life just like the Devil

  3. #3
    Senior Member
    Join Date
    Jun 2000
    Location
    Waltham, MA
    Posts
    107
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    You can use the DateStr() function, returning just the system date as a string, format the date contained in the ANYTYPE data set, and then just compare the 2 strings.

  4. #4
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    FormatDateTime() returns a string value so you shouldn't get the Mismatch data type error. Post your code so someone can take a look.
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  5. #5
    Senior Member
    Join Date
    Sep 2002
    Location
    ONDlodnol
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    TELL ME IF THIS WILL WORK, I GUESS I FIXED IT???


    [-] private Match_DateTime()//compares date/time values from OLE fields
    [ ] string sYear
    [ ] string sMonth
    [ ] string sDay
    [ ] string sHour
    [ ] string sMinute
    [ ] string sAMPM
    [ ] string sNum
    [ ] datetime dtEnd
    [ ] datetime dtStart
    [ ] integer iMonth
    [ ] integer iYear
    [ ] integer iDay
    [ ] integer iHour
    [ ] integer iMinute
    //Get the Time and Date from the Commint D/T field
    [ ] iMonth = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker("Comm t D?T").iMonth//get the value of field in integer
    [ ] sNum = Str (iMonth)//convert to string
    [ ] MatchStr(sNum, sMonth)//match the 2 strings
    [-] if sNum == sMonth//test comparing the 2 values
    [ ] iYear = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker("Comm t D?T").iYear//get the value of field in integer
    [ ] sNum = Str (iYear)//convert to string
    [ ] MatchStr(sNum, sYear)//match the 2 strings
    [-] if sNum == sYear//test comparing the 2 values
    [ ] iDay = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker("Comm t D?T").iDay//get the value of field in integer
    [ ] sNum = Str (iDay)//convert to string
    [ ] MatchStr(sNum, sDay)//match the 2 strings
    [-] if sNum == sDay//test comparing the 2 values
    [ ] iHour = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker("Comm t D?T").iHour//get the value of field in integer
    [ ] sNum = Str (iHour)//convert to string
    [ ] MatchStr(sNum, sHour)//match the 2 strings
    [-] if sNum == sHour//test comparing the 2 values
    [ ] iMinute = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker("Comm t D?T").iMinute//get the value of field in integer
    [ ] sNum = Str (iMinute)//convert to string
    [ ] MatchStr(sNum, sMinute)//match the 2 strings
    [-] if sNum == sMinute//test comparing the 2 values
    [ ] sNum = Str(iMinute)//convert to string
    [ ] MatchStr(sNum, sMinute)//match the 2 strings
    [ ]
    [ ] //************************************************** ****************/
    [ ] //Formats the system time and date
    [ ] dtStart = GetDateTime ()
    [ ] sYear = FormatDateTime (dtStart, "yyyy")//year
    [ ] sMonth = FormatDateTime (dtStart, "m")//month
    [ ] sDay = FormatDateTime(dtStart, "dd") //day
    [ ] sHour = FormatDateTime (dtStart, "hh")//hour
    [ ] sMinute = FormatDateTime (dtStart, "nn")//minute
    [ ] sAMPM = FormatDateTime (dtStart, "AM/PM")//time mode
    [ ] dtEnd = "{sMonth}/{sDay}/{sYear} {sHour}:{sMinute}: {sAMPM}"//bring formatting togther
    [ ] //************************************************** *****************/
    [ ] //compare and matches the time and date from commint D/T field
    [ ] MatchStr(sNum, sYear)
    [-] if sNum == sYear
    [ ] print ("The Year field match")
    [-] else
    [ ] // val
    [ ] LogError("The Year field doesn't match")
    [ ] MatchStr(sNum, sMonth )
    [-] if sNum == sMonth
    [ ] print("The Month field match")
    [-] else
    [ ] LogError("The Month field doesn't match")
    [ ] MatchStr(sNum, sDay )
    [-] if sNum == sDay
    [ ] print("The Day field match")
    [-] else
    [ ] LogError("The Day field doesn't match")
    [ ] MatchStr(sNum, sHour )
    [-] if sNum == sHour
    [ ] print("The Hour field match")
    [-] else
    [ ] LogError("The Hour field doesn't match")
    [ ] MatchStr(sNum, sMinute )
    [-] if sNum == sMinute
    [ ] print("The Minute field match")
    [-] else
    [ ] LogError("The Minute field doesn't match")
    [ ]
    [ ]
    [ ] //************************************************** *********************/
    Goodness is a part of life just like the Devil

  6. #6
    Super Member
    Join Date
    Jul 2003
    Location
    Boulder, CO
    Posts
    1,276
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    Try reposting that between two code tags...

    i.e. the word code between this: [ and this: ]

    (if I actually type it in well then....)

    and at the end:

    this: [ and then /code and then this: ]

    It will be much easier to read. [img]images/icons/smile.gif[/img]
    Chris R Mead

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

  7. #7
    Senior Member
    Join Date
    Sep 2002
    Location
    ONDlodnol
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Converting DateTime

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] private Match_DateTime()//compares date/time values from OLE fields
    [ ] string sYear
    [ ] string sMonth
    [ ] string sDay
    [ ] string sHour
    [ ] string sMinute
    [ ] string sAMPM
    [ ] string sNum
    [ ] datetime dtEnd
    [ ] datetime dtStart
    [ ] integer iMonth
    [ ] integer iYear
    [ ] integer iDay
    [ ] integer iHour
    [ ] integer iMinute
    [ ] //************************************************** ****************/
    [ ] //Get the Time and Date from the Commint D/T field
    [ ] //************************************************** ****************/
    [ ] iMonth = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker(&quot ;Commt D?T&quot.iMonth//get the value of field in integer
    [ ] sNum = Str (iMonth)//convert to string
    [ ] MatchStr(sNum, sMonth)//match the 2 strings
    [-] if sNum == sMonth//test comparing the 2 values
    [ ] iYear = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker(&quot ;Commt D?T&quot.iYear//get the value of field in integer
    [ ] sNum = Str (iYear)//convert to string
    [ ] MatchStr(sNum, sYear)//match the 2 strings
    [-] if sNum == sYear//test comparing the 2 values
    [ ] iDay = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker(&quot ;Commt D?T&quot.iDay//get the value of field in integer
    [ ] sNum = Str (iDay)//convert to string
    [ ] MatchStr(sNum, sDay)//match the 2 strings
    [-] if sNum == sDay//test comparing the 2 values
    [ ] iHour = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker(&quot ;Commt D?T&quot.iHour//get the value of field in integer
    [ ] sNum = Str (iHour)//convert to string
    [ ] MatchStr(sNum, sHour)//match the 2 strings
    [-] if sNum == sHour//test comparing the 2 values
    [ ] iMinute = CMiscReport.SSScrollBase.FrameB1.OLEDTPicker(&quot ;Commt D?T&quot.iMinute//get the value of field in integer
    [ ] sNum = Str (iMinute)//convert to string
    [ ] MatchStr(sNum, sMinute)//match the 2 strings
    [-] if sNum == sMinute//test comparing the 2 values
    [ ] sNum = Str(iMinute)//convert to string
    [ ] MatchStr(sNum, sMinute)//match the 2 strings
    [ ]
    [ ] //************************************************** ****************/
    [ ] //Formats the system time and date
    [ ] dtStart = GetDateTime ()
    [ ] sYear = FormatDateTime (dtStart, &quot;yyyy&quot//year
    [ ] sMonth = FormatDateTime (dtStart, &quot;m&quot//month
    [ ] sDay = FormatDateTime(dtStart, &quot;dd&quot //day
    [ ] sHour = FormatDateTime (dtStart, &quot;hh&quot//hour
    [ ] sMinute = FormatDateTime (dtStart, &quot;nn&quot//minute
    [ ] sAMPM = FormatDateTime (dtStart, &quot;AM/PM&quot//time mode
    [ ] dtEnd = &quot;{sMonth}/{sDay}/{sYear} {sHour}:{sMinute}: {sAMPM}&quot;//bring formatting togther
    [ ] //************************************************** *****************/
    [ ] //compare and matches the time and date from commint D/T field
    [ ] MatchStr(sNum, sYear)
    [-] if sNum == sYear
    [ ] print (&quot;The Year field match&quot
    [-] else
    [ ] // val
    [ ] LogError(&quot;The Year field doesn't match&quot
    [ ] MatchStr(sNum, sMonth )
    [-] if sNum == sMonth
    [ ] print(&quot;The Month field match&quot
    [-] else
    [ ] LogError(&quot;The Month field doesn't match&quot
    [ ] MatchStr(sNum, sDay )
    [-] if sNum == sDay
    [ ] print(&quot;The Day field match&quot
    [-] else
    [ ] LogError(&quot;The Day field doesn't match&quot
    [ ] MatchStr(sNum, sHour )
    [-] if sNum == sHour
    [ ] print(&quot;The Hour field match&quot
    [-] else
    [ ] LogError(&quot;The Hour field doesn't match&quot
    [ ] MatchStr(sNum, sMinute )
    [-] if sNum == sMinute
    [ ] print(&quot;The Minute field match&quot
    [-] else
    [ ] LogError(&quot;The Minute field doesn't match&quot
    [ ]
    [ ]
    [ ] //************************************************** *********************/</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    Goodness is a part of life just like the Devil

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:10 PM.

Copyright BetaSoft Inc.