PFC DateTime Service (n_cst_datetime)
The Date/Time service provides methods to perform calculations with dates.
It includes the following features:
- Convert seconds to either days or hours
- Convert between Julian and Gregorian dates
- Identify the Julian day number for a given date
- Identify the week number for a given date
- Identify the day of the week for a given date
- Determine the first or last date of the month for a specified date
- Determine if a date falls within a leap year
- Determine if a date is a weekday or on the weekend
- Validate a value to see if it is a valid date or DateTime
- Compute the number of milliseconds between two times
- Compute the number of whole weeks, months, or years between two dates
- Compute the number of seconds between two DateTime values
- Obtain relative dates before/after specified seconds, months or years
- Stop processing until a specified date/time is reached
How do I time how long an activity takes?
Use of_SecondsAfter() or of_MilliSecsAfter()
datetime ldtm_begin, ldtm_end
n_cst_datetime lnv_datetime
ldtm_begin = Datetime(Today(), Now())
// Stuff you want to time is here
ldtm_end = Datetime(Today(), Now())
MessageBox("Time check", String(lnv_datetime.of_SecondsAfter(ldtm_begin, ldtm_end)))
How do I validate if a datetime has been populated?
True if the value is not null or equal to the datetime default
lnv_datetime.of_IsValid(ldtm_check)
How do I find the day of the week?
Use the of_DayOfWeek function :
datetime.of_DayOfWeek ( sourcedate )
Argument: date (sourcedate) Date variable that contains the day to be determined
Returns : Integer. (values, as follows)
1 Sunday
2 Monday
3 Tuesday
4 Wednesday
5 Thursday
6 Friday
7 Saturday
No comments yet.
Leave a comment
-
Archives
- May 2009 (1)
- March 2009 (1)
- January 2009 (2)
- December 2008 (1)
- November 2008 (2)
- September 2008 (1)
- August 2008 (1)
- July 2008 (24)
- June 2008 (22)
- May 2008 (69)
- April 2008 (25)
-
Categories
-
RSS
Entries RSS
Comments RSS