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 method

Using 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 PeopleCode的更多相关文章

  1. 一些peoplecode小技巧【一】

    1. Get the description of the translate value: No need to write SQLEXEC on PSXLATITEM passing fieldn ...

  2. PeopleCode 处理压缩文件

     PeopleSoft中对文件附件的处理都是单个文件处理的,虽然在8.52版本新增了MAddAttachment(URLDestination, DirAndFilePrefix, Prompts, ...

  3. JavaScript Date对象

    本篇主要介绍 Date 日期和时间对象的操作. 目录 1. 介绍:阐述 Date 对象. 2. 构造函数:介绍 Date 对象的构造函数new Date()几种方式. 3. 实例方法:介绍 Date ...

  4. ExtJS 4.2 Date组件扩展:添加清除按钮

    ExtJS中除了提供丰富的组件外,我们还可以扩展他的组件. 在这里,我们将在Date日期组件上添加一个[清除]按钮,用于此组件已选中值的清除. 目录 1. Date组件介绍 2. 主要代码说明 3. ...

  5. Java 时间类-Calendar、Date、LocalDate/LocalTime

    1.Date 类 java.util.Date是一个"万能接口",它包含日期.时间,还有毫秒数,如果你只想用java.util.Date存储日期,或者只存储时间,那么,只有你知道哪 ...

  6. 为什么你SQL Server的数据库文件的Date modified没有变化呢?

    在SQL Server数据库中,数据文件与事务日志文件的修改日期(Date Modified)是会变化的,但是有时候你会发现你的数据文件或日志文件的修改日期(Date Modified)几个月甚至是半 ...

  7. mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法!

    mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法! 修改mysql5.7的配置文件即可解决,方法如下: linux版:找到mysql的安装路径进入默认的为/usr/shar ...

  8. date命令

    GNU的date提供+%s(小写s), 能打印出自1970-01-01 00:00:00到当前时间的秒数. 这可能大家都不陌生,但有两点需要注意: 1. %s存在于GNU扩展版本.像在solaris等 ...

  9. 【Spring】SpringMVC中浅析Date类型数据的传递

    在控制器中加入如下代码: @InitBinder public void initBinder(ServletRequestDataBinder bin){ SimpleDateFormat sdf ...

随机推荐

  1. Java中-XMX -xmn 是什么的缩写

    这个应该是 eclipse 的配置文件 eclipse.ini 中的配置语句.在配置文件中直接传递给 java vm 的参数并不多,调用形式是这样的: 1 eclipse [normal argume ...

  2. 非常详细GC学习笔记

    转载:http://blog.csdn.net/fenglibing/article/details/6321453 这是我公司同事的GC学习笔记,写得蛮详细的,由浅入深,循序渐进,让人一看就懂,特转 ...

  3. tomcat服务器不输出访问日志

    有时候一个WEB服务作为接口部署在tomcat下,因为访问很频繁,导致/var/log/tomcat7下的访问日志急剧膨胀,影响服务器的性能. 在这里我的方法是关闭访问日志,关闭方法为将访问日志的输出 ...

  4. Python 之字节转换

    # coding: utf-8 def bytes2human(n): """ >>> bytes2human(10000) 9K >>&g ...

  5. wince6.0应用程序自启动

    主要思想:将应用程序添加到image里,然后用应用程序代替桌面应用程序,从而使应用程序自启动. 主要步骤:                 1.将应用程序MyApp.exe拷贝到wince600\OS ...

  6. Android中通过广播方式调起第三方App

    今天紧急的跟进一个百度视频App无法调起百度贴吧App的问题,当然,这个是只发现是在4.x的android系统下发生,在2.x版本下,一切正常,(其实是3.1及以上的版本都有问题)具体场景为: 1.贴 ...

  7. unique踢出相同元素

    unique函数的功能是:去除相邻的重复元素(只保留一个). 函数参数:unique(first,last,compare); //first为容器的首迭代器,last为容器的末迭代器,compare ...

  8. 【Unity Shaders】学习笔记——SurfaceShader(二)两个结构体和CG类型

    [Unity Shaders]学习笔记——SurfaceShader(二)两个结构体和CG类型 转载请注明出处:http://www.cnblogs.com/-867259206/p/5596698. ...

  9. dll 学习(一)

    DLL(Dynamic Link Library)的概念,你可以简单的把DLL看成一种仓库,它提供给你一些可以直接拿来用的变量.函数或类.在仓库的发展史上经历了"无库-静态链接库-动态链接库 ...

  10. PC上安装MAC X Lion

    PC上安装MACXLion 网上关于如何在PC下安装MAC的文章已近不少了,但对于一些初学者在实践当中会遇到各种问题,以下视频资料为大家展示两种虚拟机安装MacOS. 1.VmwareWorkstat ...