Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In the following snippet of code I' 1

Status
Not open for further replies.

ABOzIT

IS-IT--Management
May 1, 2003
226
0
0
JP
In the following snippet of code I'm establishing todays date.

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As Notesdatabase
Dim maindoc As NotesDocument
Dim doc As NotesDocument

Dim dateTime As New NotesDateTime( "" )
dateTime.LSLocalTime = Now
doc.maindoc_line= Cstr(dateTime.DateOnly)

In my application the date is appearing as MM/DD/YYYY. Being in Australia I need DD/MM/YYYY. How do I alter this code so it relects the correct format?

Many thanks!
 
You do not alter your code, since the appearance relies solely on two parameters :
- the Notes clients that are used
- the parameters in Regional Settings in Windows

Indeed, if you are working with R5/6 everywhere, then you can change the field display to Custom in Field Properties and ensure that the display is as you need it to be on the document.
Otherwise, Notes will adapt itself automatically following the Date settings defined in Windows.
If you really want to make sure, just use a Computed for Display field that reformats your date in text when the user opens the document.
Be aware that the server does not like having date formats tinkered with in views. Doing so will probably jeapordize the integrity of the view if the date column is used in sorting.
If you really want date format to be fixed in views, then you will be better off using a hidden column for the true value, and displaying your format in a visible, non-sorted column after the hidden one.

This said, I must admit I question the validity of fixing the date format. Given that Notes adapts itself automatically to the users regional settings, I find that such practices put the validity of the information in peril without a format reminder behind the value.

But that is just my opinion.
 
You raise some good points there!

I think I've now solved the problem. An agent running on the server was creating dates with the format correct. I discovered that 1 workstation that was running another agent locally and updating fields in his local replica had the system date format as US. I couldn't work out why the same code was producing different results.

Thanks for your reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top