WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Parse a Date and Miscellaneous FileTimeGet Questions

Keywords:    parse date 	FileTimeGet

Question (1125: FileTimeGet: File not found Error):

I'm getting the "1125: FileTimeGet: File not found" error on a file that's already open by another application.

It looks as if I can have problems if the FileYmdHms on the file I'm interested in is executed exactly when the application is trying to close out that message file. The application fails.

So what does FileYmdHms do? Does it actually open the file or lock it? What would be the limitations on access by another program at the same instant? Why does it fail when another program has opened the file? Or does it only fail if the other program has locked the file?

I may have to go back to fixed time delays until we get the 32 bit version of this application. We tried RunWait in various flavors last year when we were setting up this process, and they were not reliable. Does the more recent WinBatch have better Wait functions for running 16 bit apps under 32 bit WinBatch on NT 3.51?

Answer:

The old version 97D of WinBatch opens the file to get the date. In current versions of Winbatch, the FileTimeGet no longer updates the file's last-access time.

FileTimeGet needs read access to the file to check the time. I'm not sure what version you are running. You might try adding the following code just before you check the time...

   while FileExist("youfilenamehere")==2
      TimeDelay(2)
   endwhile
or maybe (or maybe in addition to the above):
   While 1
      Errormode(@off)
      xxx=FileTimeGet("yourfilenamegoeshere")
      ErrorMode(@cancel)
      if xxx!=0 then break
      TimeDelay(2)
   endwhile

Question:

I'm getting the error:
	1125: FileTimeGet: File Not Found
	fcode=FileTimeCode(ExtDllName)
error when I try to compile with WBC 99C.

Answer:

Start up your Compiler, and click on the Extenders button, then don't choose any extenders, and click OK. Now "none" should be displayed next to the extenders button on the dialog.

Now see if the compile works. If it does, hit the Extenders button, choose the extenders you want, and then click OK. The compile should work again.


Question:

My WinBatch program worked well until April the 1st. Was it a joke ? No ! Only something to do with ITEMEXTRACT and DATETIME. Here is the code:
	Day = ItemExtract( 1, TimeDate(), ' ')
	Date = ItemExtract( 2, TimeDate(), ' ')
It works if I have "Sun 29/03/98 12:27:43" but not if I have "Sun 5/04/98 8:14:51" The date became the 3rd item !

I have the same problem with FILETIMEGET. I received today " 9/04/98 12:12"

  1. In the example, there are 2 spaces between "Sun" and "5/04/98". This is why the date is the 3rd item.

  2. I use the european date (dd/mm/yy). The same is certainly true if you use mm/dd/yy.

  3. As far as I remember, I always uses leading zeroes for the date and time. I do not know what happened to them. Which values do you take from the [intl] section of the WIN.INI ?

Any suggestion ?

Answer:

DO NOT USE TimeDate, DateTime, or FileTimeGet for computations. They are for displaying times and dates to the user.

Use:

TimeYmdHms and FileYmdHms to get STANDARD format date/times that are "machine-able" and can safely be used in computations, ItemExtract, etc etc.

For example:

	a=TimeYmdHms()	  ;;Get the current date and time

	;;parse the date out  
	Year=Itemextract(1, a, ":")
	Month=ItemExtract(2, a, ":")
	Day=ItemExtract(3, a, ":")	

Question: Another 1125 FileTimeGet Error:

I had a WB file that worked fine in Win3.1, but now when the same file is compiled with the 32-bit WB99 version, I'm getting the 1125 FileTimeGet Error.

Answer:

Make sure you use the IntControl 29 function to standardize the file delimiters between Windows 3.x and Windows 95/98/NT. You can get this error message when your file list delimiters aren't being recognized correctly.

Question (Parsing Date from DateTime):

How do I parse a date out of the DateTime string and display it to the user?

Answer:

Here's an example:
a=TimeDate( )
  ;;;datetime has 3 parts to it.  To separate them:
ParseData(a)

  ;;;This will separate it into 3 separate parts; param1, param2, param3
Year=ItemExtract(3, param2, "/")
Month=ItemExtract(1, param2, "/")
Day=ItemExtract(2, param2, "/")

  ;;;Some days and months may only have one digit.  To make sure they have two digits:
If StrLen(month) == 1 Then month="0%month%"
If StrLen(day) == 1 Then day= "0%day%"

   ;;;Finally you need to concantenate the parts together.
date=StrCat( year, month, day)
Pause("Revised Date =", date)

Article ID:   W13877
Filename:   Parsing a Date and FileTimeGet Issues.txt
File Created: 2011:06:24:08:18:52
Last Updated: 2011:06:24:08:18:52