Jump to content
Sign in to follow this  
yoinkster

Question about _Date_Time_GetSystemTime and For Next loops

Recommended Posts

yoinkster

does _Date_Time_GetSystemTime() return the time in a standard form ro does it depend on the machine it's running on? I'm generating a filename from the system date and I'm worried that in the UK _Date_Time_GetSystemTime() will return a dd/mm/yyyy date and in the US it'll give a mm/dd/yyyy and thus make my filenames look silly.

$time = _Date_Time_GetSystemTime()
$shakeup = StringSplit(_Date_Time_SystemTimeToDateStr($time),"/")
$bname = "-" & $shakeup[3] & "-" & $shakeup[1] & "(" & _DateToMonth($shakeup[1], 1) & ")-" & $shakeup[2] & ".ZIP"oÝ÷ Ú¯zƧzwh~Ø^~)^©¡ü²Ë)¦ØgjguÂ¥v+fjG'b}÷«zwûayÖ­yú+«hØ^§!w°jÇb}÷«z{LÊazº®zËb¢x¬i¸­¦§¶W¬±»­"ØhºmÝýu·zËm¢IèÂƲ~ÞÅ©©â!iÖ®¶­sbb33c¶Ò¤f÷"b33c¶ÒFò£·7GVf`¤æW

Would it know that you are only on the first iteration and set $i back when going through the loop again or does it take the value of $i?

My guess would be you'd end up with an array like

myArray[0] = ""

myArray[1] = ""

myArray[2] = ""

myArray[3] = ""

myArray[4] = ""

myArray[5] = 0

myArray[6] = 1

etc

Share this post


Link to post
Share on other sites
Melba23

yoinkster,

Q1. As _Date_Time_GetSystemTime returns a structure ($tagSYSTEMTIME), which is then parsed by _Date_Time_SystemTimeToDateStr, I believe you should get the same string regardless of the system settings.

Q2. Why not try it and see:

$i = 0
For $i = 0 to 10
;stuff
Next
ConsoleWrite($i & @CRLF)

Q3. Same answer - try it and see!

Why ask simple questions when a few lines of code - which you had to write so that you could post - will give you the answer?

M23

A2. In fact, you will see that $i is one over the upper limit - which is perfectly logical when you think about it.

A3. Basically $i goes up by 1 each time you reach Next. If you increase $i yourself in the code, Next will take the value you have set and add 1 to that - so your guess is correct.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
yoinkster

Hey M23, I had indeed checked it as I asked but sort of wanted an answer that wasn't just "yeah yeah yeah, fine", your answer for Q3 for example was what I was hoping someone would indeed clarify so thanks (:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×