Using the code below I always get the same date and time
1969Y-12M-31D_19H-0M-0S.jpg
It doesn't matter what code I put in, this is just an example. This code renames a file to new current day and time (without all of the extra characters that mess things up). So, am I using the DateTime wrong? Why does it always return the same date and time?
1969Y-12M-31D_19H-0M-0S.jpg
It doesn't matter what code I put in, this is just an example. This code renames a file to new current day and time (without all of the extra characters that mess things up). So, am I using the DateTime wrong? Why does it always return the same date and time?
B4X:
'rename pic to current date and time
Dim NewFN, OldFN As String
'------------------------------------------
Dim RenameBefore, RenameAfter, RenameAfter1, RenameAfter2 As String
Dim now As Long
RenameBefore = ExpPicFilename
RenameAfter1 = DateTime.GetYear(now) & "Y-" & DateTime.GetMonth(now) & "M-" & DateTime.GetDayOfMonth(now) & "D_"
RenameAfter2 = DateTime.GetHour(now) & "H-" & DateTime.GetMinute(now) & "M-" & DateTime.GetSecond(now) & "S"
RenameAfter = RenameAfter1 & RenameAfter2
OldFN = (ExpPicFilepath & RenameBefore)
NewFN = (ExpPicFilepath & RenameAfter & ".jpg")
RenameFile(File.DirRootExternal, OldFN, File.DirRootExternal, NewFN)
ExpPicFilename = RenameAfter
Msgbox("Picture that was associated to the deleted record was renamed to: " & RenameAfter, "")