Date and Time in PeopleCode
2013-10-24 13:40
501 查看
Setting a Date to Null in PeopleCode
To set a date to null in PeopleCode either use the SetDefault() function (deprecated) or the SetDefault field methodUsing the function:
SetDefault(YOUR_RECORD.DT_FIELD);
Using the field method If you are in the current context:
YOUR_RECORD.DT_FIELD.SetDefault();
Using the field method if you are not in the current context using a field object:
Local Field &fldDateExample;/* Code to set your &fldDateExample object */&fldDateExample.SetDefault();
Not intuitive but it works.
Setting a Date to Null in PeopleCode (Part II - another way!)
There is also another way to set a date to null via PeopleCode! In some cases, using SetDefault() to blank out a field is not what we're after, as there may be a default for the field! The only other way (to my knowledge) is this:RECNAME.DATE_FIELD.Value = "";
.Value is the KEY here. Not including .Value will throw Syntax errors in App Designer when you try to assign the date field to "" and save your program.
Getting the time in the format HHMMSS from the current time:
Getting time in the format HHMMSS from the current time:Local &strCurrentTime;&strCurrentTime = Substring(Substitute(String(TimePart(%Datetime)), ".", ""), 1, 6);
This takes the time part of the current date time on the application server, replaces the dot (.) seperators with blanks, and returns only the first 6 characters (hhmmss) ignoring the millisecond part. This returns say a time of 11.52.00.000000 as 115200. I used this in an application to rename a file with a date & time stamp.
Use %DateOut to Get Dates from SQL into a Date Variable
If you are using a date that is returned from SQL and storing it into a date variable, make sure you wrap your date with %DateOut in your SQL, otherwise PeopleSoft will throw an invalid date error.相关文章推荐
- Date and Time in ADF
- [原] XAF How to see and edit the time part in the DatePropertyEditor for the System.DateTime property
- Date and Time in C++
- Date and Time in C++
- Date and Time Representation in Python
- CodeProject: EasySize - Dialog resizing in no time!. Free source code and programming help
- CodeProject: EasySize - Dialog resizing in no time!. Free source code and programming help
- Date and Time Representation in Python
- date and time in Android
- Substitute and Replace functions in PeopleCode
- Date and Time Arithmetic in JScript zz
- [leet code] Best Time to Buy and Sell Stock II
- How to get current date time in SharePoint Site Time Zone
- SnmpSharpNet OctetString DateAndTime自定义解析
- date and time information matlab
- Date and Time
- Concurrent and Real-Time Programming in Ada
- The unit impulse and step functions in Discrete-time
- Structure of a C-Program in Memory | How Heap,Stack,Data and Code segments are stored in memory?
- sql: MySQL and Microsoft SQL Server Stored Procedures IN, OUT using csharp code