How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

HI,

Could anyone suggest me how we can convert date/time of format yyyy/mm/dd to date/time of format yyyy-mm-dd

using lotus script

Thanks in advance

– lakshmi

Subject: How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

Dim someDate as NotesDateTimedim d,m,y as integer

set someDate = new NotesDateTime (yyyy/mm/dd) 'check syntax1

d = day(someDate)

m = month(someDate)

y = year(someDate)

print cstr(y) + “-” cstr(m) + “-” cstr(d)

'use the format function to add zero’s infront of it etc.

Subject: RE: How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

Hi Jean,

Thanks for the quick response. But i want the output should be in date/time datatype with the example given by you we will get the string output

– lakshmi

Subject: RE: How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

Hi Lakshmi,

The first question is, why do you need this? If you need a date/time data, than the separator is defined in the windows control panel. So as I know, you cannot convert the date/time value to an other date time value with other separator, because the separator is defined in windows.

You can use custom setting in date/time field, but it will have only UI effect.

You can use the “International” class to get user’s date separator property, if you need.

So when you use a data field, you may see yyyy/mm/dd, I would see yyyy.mm.dd, an other user mm/dd/yyyy or yyyy-mm-dd. This depend on your local settings.

Attila

Subject: RE: How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

Hi Attila,

Thanks for the details. This is the customer requirement. Let me explain you the exact requirement.



In the form, we have DateFrom field which is text field (tried even with date/time field also). While submitting the form we are creating a document in the another database and need to update the field DateFrom in the format yyyy-mm-dd of date/time field

It is a web application.

Hope you understand the requirement

Please guide me

–Lakshmi

Subject: RE: How to conver yyyy/mm/dd to yyyy-mm-dd using lotus script

Sorry, I’m not sure, that I understand everything. So you have documentA(in databaseA), with a text field named DateFrom. When you submit the form, you are creating DocumentB (in databaseB), and documentB has also a DateFrom field, which is date/time field and the format, you need is yyyy-mm-dd.

In this case in DocumentB in DateFrom field’s property on the second tab you can specify the date format (use preferences from=Costum, and than you can select the separator)

Hope this help you.

Attila