Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.

More fun with dates in LotusScript
By Mick Moignard

I'm sure that anyone who's had more than a passing involvement with Notes applications and with LotusScript has had involvement with date/time fields. Indeed I've written about some aspects of date fields before, see DominoPower Magazine January 2003, "Tips and tricks in LotusScript", http://www.dominopower.com/issues/issue200302/script001.html, where I mentioned how date fields are stored, and how the internal value can be manipulated via a Variant date type.

Dates seem to be an ongoing problem, and indeed in the project I'm still working on we've dealt with a number of date-field issues. The application deals with synchronizing data entered in a Notes-client front-end system with a back-end Oracle database, using LEI (Lotus Enterprise Integrator) and Scripted Activities, which connect to Oracle using the back-end connectors and the Lotus Connector LSX (LotusScript Extension), lsxlc. We've had some interesting incidents with null date values, and we've also had to find ways around other content and representational issues. Let's look at a couple of them.

Getting rid of the time component
The first one has been about trying to lose the time-portion of a Notes date-time value. In Oracle, as in Notes, date type values contain a date and a time. In most cases the front-end application is only interested in dates. While many of the front-end fields truncate the time part, quite a few don't. We experimented quite a bit before we found, what was in hindsight, the rather obvious answer.

First we checked using NotesDateTime.DateOnly, but of course this returns a string, not a date. So that's no good. One reason is because when you try to put a string date value back into a Notes Date/Time field, you're at the mercy of how the date string is interpreted, which I covered in the January 2003 article. It's not good practice to convert strongly typed values like dates to weaker types, like a string, and back again.

Then we tried setting the time portion of the time to zero, and predictably that displayed dates with zero times. Also no good. But we knew that Notes could store a date with no time, because we could see it in the properties box and with Notespeek. We found that a field typed as "date only" appeared as follows in Notespeek.

name "dateonly"
type Time
class Time
flags Summary
length 8
value <29/11/2004> ; 00256F5B:FFFFFFFF

While a field defined as date and time had a value line that looked like this:

value <29/11/2004 11:03:00> ; 80256F5B:003CB310

And the difference is obvious. But how to set the time portion to x"FF"?


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login