Difference between revisions of "DateTime"

From Team Developer SqlWindows Wiki
Jump to: navigation, search
(New page: This page covers datetime datatype tips & tricks. __TOC__ <br> <h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold; border:1px solid #afa3bf;text-align:left;colo...)
 
Line 1: Line 1:
This page covers datetime datatype tips & tricks.
+
'''This page covers datetime datatype tips & tricks.'''
  
 
__TOC__
 
__TOC__
 
<br>
 
<br>
  
<h2 style="margin:0;background-color:#ddcef2;font-size:120%;font-weight:bold;
+
{{TipHeader|How to strip elements from a DateTime}}
border:1px solid #afa3bf;text-align:left;color:#000;padding:0.2em 0.4em;">[[Image:Pointer.png]]How to strip elements from a DateTime</h2>
+
 
 
The next function is able to strip certain parts from a datetime.<br>
 
The next function is able to strip certain parts from a datetime.<br>
 
So with this it is possible to construct a new datetime value with only the wanted elements.<br>
 
So with this it is possible to construct a new datetime value with only the wanted elements.<br>

Revision as of 23:38, 21 September 2008

This page covers datetime datatype tips & tricks.

Contents


Pointer2.png How to strip elements from a DateTime Pointer.png

The next function is able to strip certain parts from a datetime.
So with this it is possible to construct a new datetime value with only the wanted elements.
Milliseconds are allways stripped.

Function: PALDateConstruct
   Returns
      Date/Time:
   Parameters
      Date/Time: pdtDateTime
      Boolean: pbYearMonthDays
      Boolean: pbHoursMinutes
      Boolean: pbSeconds
   Local variables
      Number: nYear
      Number: nMonth
      Number: nDay
      Number: nHour
      Number: nMinute
      Number: nSecond
   Actions
      If pbYearMonthDays
         Set nYear   = SalDateYear( pdtDateTime )
         Set nMonth  = SalDateMonth( pdtDateTime )
         Set nDay    = SalDateDay( pdtDateTime )
      If pbHoursMinutes
         Set nHour   = SalDateHour( pdtDateTime )
         Set nMinute = SalDateMinute( pdtDateTime )
      If pbSeconds
         Set nSecond = SalDateSecond( pdtDateTime )
      Return SalDateConstruct( nYear, nMonth, nDay, nHour, nMinute, nSecond )

So to strip of the seconds from the current datetime

   dtTodayNoSeconds = PALDateConstruct( SalDateCurrent( ), TRUE, TRUE, FALSE )


Pointer.pngEnter new tip title here

Enter new tip description here