Khalis Posted February 13, 2009 Share Posted February 13, 2009 Hi.. Now I'm trying to figure out how to display days and dates for a week using daq..but for this moment I didin't know where to start...totally blank..i hope that you can give some tips to start ..thank you..example as below monday = 1 Jun 2008 : : : sunday = 7 Jun 2008 Link to comment Share on other sites More sharing options...
AzeoTech Posted February 13, 2009 Share Posted February 13, 2009 Use the formatdatetime() function. So, for example, type this at the command line: ? formatdatetime("%A %d %b %Y",systime()) I get (given the date systime() returns): Friday 13 Feb 2009 See the Expressions chapter-> Expressio Operator / Function Reference -> Time Functions for more details. Link to comment Share on other sites More sharing options...
Khalis Posted February 14, 2009 Author Share Posted February 14, 2009 I'm already familiar with that function..but what I'm trying to do right now is to display the date automatically..for example, if I insert date on Monday (let say 1 Jun 2008), the rest 6 days will automatically display the dates ( Tues - 2 Jun 2008 ,.....,Sunday - 7 Jun 2008)..if i'm not mistaken, the time function only view the current date only... Link to comment Share on other sites More sharing options...
AzeoTech Posted February 14, 2009 Share Posted February 14, 2009 Insert the other 6 days where? The formattime / formatdate / formatdatetime functions take any time. I just showed a sample using systime(), which is the current time. You can do anything else. For example if: ? formatdatetime("%A %d %b %Y",systime()) shows Friday as I said above, then: ? formatdatetime("%A %d %b %Y",systime() + 86400) will show Saturday and ? formatdatetime("%A %d %b %Y",systime() + 86400*2) sunday, etc. since there are 86400 seconds in a day. Link to comment Share on other sites More sharing options...
Khalis Posted February 16, 2009 Author Share Posted February 16, 2009 Thanks for the coding before but there two more things that I want to ask you 1 - Let say today is Monday, so I want to compare the "monday" with formatdatetime. Can I? My idea like this, if the user open the daq application on monday, it okay because I can use the coding that you just gave me before. But what if the user try to open it on Wednesday, what I thought was I need to compare the day with formatdatetime first so that I can modify your suggested coding and view the date before and after Wednesday. (Refer Pic) 2 - Let say on Monday, I want to turn on Lamp No. 1 and No. 2. After that, I want to save the setting/selection that I just made. Can you give me suggestions on how can I save and then retrieve the setting back? Link to comment Share on other sites More sharing options...
AzeoTech Posted February 16, 2009 Share Posted February 16, 2009 1) I'm not completely sure what you are asking, but yes, you can use formatdatetime() to see what day of the week it is. For example, to see if today is a monday, you'd do: if (formatdatetime("%A",systime()) == "Monday") 2) two choices: a) use the registry (see registry variables in the help), or use regular variables, probably some arrays, and use the file. functions to write the settings to disk and read them back. If you only have a few values, say less than 20, its usually easier to use the registry, but you can't backup settings or allow the user to open different sets of settings (batches so to speak). For that, a file is appropriate. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.