Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaHi Erik,
In the version which I am running (i.e. 9.5 SP1), the Date(Now) returns the current data with the padded day and month, and EMWriteScreen will not trim the 0 in the Month or Day.
If you find that in 9.5 that the Month and Day parts of Date are getting trimmed, then you can try casting the Date to a string.
If you need the use a different delimiter you can parse the Month, Day and Year part from Date.
e.g. All three methods work for me
Sub Main
' EMConnect "A"
'1. Just using Date
EMWriteScreen Date, 18,8
'2. Casting Date to a String
EMWriteScreen CStr$ (Date), 19,8
'3. Parsing the String and picking out the Day, Month and Year.
'First Choose the demiliter you want to use
myDelimiter$ = ":"
EMWriteScreen Left(Date, 2),20,8 'Month
EMWriteScreen MyDelimiter, 20, 10
EMWriteScreen Mid(Date, 4, 9), 20,11 'Day
EMWriteScreen MyDelimiter, 20, 13
EMWriteScreen Right(Date, 4), 20, 14 'Year
End Sub
And on Screen I see

Regards,
Tom
Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaThank you for your reply Tom.
Unfortunately, perhaps my settings are different than yours?
Here are the results from the three different methods you gave me.

Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaIf you don't at first succeed try try again :-)..
Lets ignore the Script Engines interpretation (or whatever is messing with our heads) and try this
Type Systime
Year As Integer
Month As Integer
DayOfWeek As Integer
Day As Integer
Hour As Integer
Minute As Integer
Second As Integer
Milliseconds As Integer
End Type
Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As Systime)
Sub Main
Dim tSystem as Systime
GetSystemTime tSystem
MyDate = Format(tSystem.Month, "00") & "/" _
& Format(tSystem.Day, "00") & "/" _
& Format(tSystem.Year, "0000")
Msgbox MyDate
End Sub
That should do the trick.
Cheers,
Tom
Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaThis worked perfectly!
Thank you sir!
Such a large amount of code just to make sure it has 0's though haha.
Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaOk, I hear you Erik..
So the following should work also
Sub Main
EMConnect "A"
EMWriteScreen Format(Day(Date), "00") & "/" & Format(Month(Date), "00") & "/" & Format(Year(Date), "0000"), 20, 8
End Sub
Although you might want to swap the Day and Month bits around..
Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaOh wow that's even better!
Thank you so much Tom!
Hello everyone,
I am currently setting up scripts to run in RUMBA 9.5 and I need to insert the date in the format I need that will insert a 0 or single digit months and days. Example 05/05/1999. I can get it to input the current date however, it will mess up my current scripts if the days go to single digit, or the months go to double digit thus why I need it to return a 0.
So as the subject says I need to Insert date with Full date MM/DD/YYYY that will add 0 for single digit months and days. Example 05/05/1999.
I am using the following different commands to insert different dates. Would it be still similar to this kind of script or do I need to add an IF statement?
Sub Main
EMConnect "A"
ThisDay = Day(Now)
ThisYear = Year(Now)
ThisMonth= Month(Now)
ThisDate = date
EMWriteScreen ThisDate , 20, 8
EMWriteScreen ThisMonth, 20, 7
EMWriteScreen ThisDay, 20, 9
EMWriteScreen ThisYear, 20, 12
End Sub
Thank you in advance.
#RumbaThe simplest will be
Sub Main
msgbox Format(Date, "mm/dd/yyyy")
End Sub