Date Format

Hi All,

I am facing a problem in the date time format. what i need is i provide a inputbox in lotus script which ask for date in the format “mm/dd/yyyy” where as his system date format is “dd/mm/yyyy”. now if user enter instead of dd/mm/yyyy to “mm/dd/yyyy” what ever operation i do on date and time like date1.timedifference() it use the system date format not what ever i supplied in the in put box.

Is there any why to fix this problem. but if system date format is in mm/dd/yyyy it is working properly.

I mean to say what ever calculation i use to do it should be in the format which i provided in the input box. If i use format function though it not working…

Please help

its an urgent.

Thanks & Regards,

Vikas K Sinha

Subject: Date Format Error - possible solution/workaround

This is what worked for me - I can offer no logical explanation.My problem was the same as described by many others - the client did not get its date format from the system even though the client was correctly configured. So I opened the mail box in Domino Designer - activated the Date tab - selected Column view in the Properties box and the fourth tab from the right, which shows Date/Time. I then changed the user preferences from User Setting to Custom, and selected a (random) date setup. Then I closed the Designer and restarted the Notes client - and saved my new settings. Then I repeated the whole procedure and reverted to User Setting from Custom. A to B and back again, right?. On restarting the client the date fromat settings followed the system settings. Try it - it might work for you, too.

Subject: Date Format

Why worry about the format? If you are converting a string to a date, let the user enter his own format and use Cdat (or create a NotesDateTime object with the string). There is no reason why your code should interfere with the user’s settings in any way.

Subject: RE: Date Format

Thanks Stan for your kind support,

Actually i want a result of difference between to date. I used TimeDifference method of date object. now what the problem is when i use and supply this in which

set date1 = notesDateTime(“04/02/2007”)

and set date2 = notesDateTime(“06/03/2007”)

now if i use date2.dateonly it gives me 02/04/2007 which is in mm/dd/yyyy format and this is the os date format but what i supplied “dd/mm/yyyy” and TimeDifference method return worng result.

if is change the user os setting from mm/dd/yyyy to dd/mm/yyyy then it result if fine.

Please help

Thanks with Regards,

Vikas K Sinha

Subject: RE: Date Format

Don’t use strings in your code at all – you will never have to worry about local settings if you avoid strings. You can create a NotesDateTime from a known date this way:

Set dateX = New NotesDateTime(Cstr(DateNumber(2007, 3, 28)))

When code runs locally (in the client), the user’s settings will determine what to do with the user’s input. Since you have no control over the local settings, don’t rely on them to interpret your own date strings. Using DateNumber, you avoid converting your own string until run-time, then allow the user’s own settings to convert to a string and back. Since both conversions happen on the same machine in the same block of code, you know the format will be correct.