Thursday, June 9, 2011

คำนวณหาความแตกต่างระหว่างสอง DateTime ใน Crystal report

  • ใช้ฟังก์ชัน DateDiff("s",DateTime1,DateTime2) โดยที่ DateTime1 เกิดก่อน DateTime2
  • "s" คือ Interval Type มีการกำหนดรูปแบบดังนี้
Interval type  Description 
yyyy             Year
q                  Quarter
m                 Month
y                  Day of year
d                  Day (both "y" and "d" find the difference in days)
w                 Number of weeks between startDateTime and endDateTime
ww               Number of firstDayOfWeek's between startDateTime and endDateTime
h                 Hour
n                 Minute
s                 Second

No comments:

Post a Comment