[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

DATETIME.SQC



Hi All

I ahve some problem with DATETIME.SQC. Here I am enclosing my test SQR. When
I input the datetime I am getting the results in the opposite way like If i
input AM its giving PM.

#include 'setenv.sqc'    !Set environment
#Include 'setup02.sqc'   !Printer and page-size initialization


begin-report
  do Init-DateTime
  do Init-Number
  do Get-Current-DateTime
  do Init-Report
  do Process-Main
  do Reset
  do Stdapi-Term
end-report




begin-procedure Init-Report


=

  do Stdapi-Init

  if $prcs_process_instance = ''
    do Ask-From-Thru-Date
  else
    do Select-Parameters
  end-if



end-procedure

begin-procedure Get-Values

   do Get-From-Thru-Date

end-procedure



begin-procedure Process-Main
  position (-1)
  move '1' to $Year4
  do Format-DateTime($FromDate, $FromDateTime, {DEFYMD}, '', '')
  move '1' to $Year4
  do Format-DateTime($ThruDate, $ThruDateTime, {DEFYMD}, '', '')
#ifdef ORACLE
  concat ' 12:00:00 AM' with $FromDateTime
  concat ' 11:59:59 PM ' with $ThruDateTime

#else
  concat ' 00:00:01' with $FromDateTime
  concat ' 23:59:59' with $ThruDateTime
#end-if

show 'before function Format-DateTime'
show '$FromDateTime '$FromDateTime
show '$ThruDateTime '$ThruDateTime

  do Format-DateTime($FromDateTime, $FromDateTime, {DEFYMD}, 'time',
'native')
  do Format-DateTime($ThruDateTime, $ThruDateTime, {DEFYMD}, 'time',
'native')

#ifdef INFORMIX
  concat '.000' with $FromDateTime
  concat '.000' with $ThruDateTime
#end-if

! show statems for debugging
show 'after function Format-DateTime'
show '$FromDateTime '$FromDateTime
show '$ThruDateTime '$ThruDateTime

end-procedure




#include 'hrrnctl1.sqc'  !Get run control parameter values
#include 'hrgetval.sqc'  !Get values mask routines
#include 'stdapi.sqc'    !Routines to update run status
#include 'askftd.sqc'    !From Thru Date input

#Include 'reset.sqc'     !Reset printer procedure
#Include 'curdttim.sqc'  !Get-Current-DateTime procedure
#Include 'datetime.sqc'  !Routines for date and time formatting
#Include 'number.sqc'    !Routines to format numbers


When I run this report

The input is

! $FromDateTime 1999/12/30 12:00:00 AM
! $ThruDateTime 1999/12/30 11:59:59 PM

And the output is

! $FromDateTime 30-Dec-1999 12:00:00 PM
! $ThruDateTime 30-Dec-1999 11:59:59 AM


See how its coming for AM its coming PM vice versa.

Please give me some suggestions on this.

Thanks


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com