os.time()/os.date() first day of the month

here is my code 

print( os.date( "%a","Jan 01 2014"))

this doesn’t work though

without changing the time in computer, I just want to get every 1st day of the/every month

if this is not possible, any ideas on how can I get the current week number of the month for example:

July 1, 2014 is 26th week of the year and it’s the 1st week of the month

I want its number for months,(1,2,3,4,5,1/6,…)

From the documentation of os.time() parameter:

table specifying a time to convert to seconds. If table is present, it must have fields year, month, and day, and may have additional fields hour, min, sec, and isdst (for a description of these fields, see the os.date function).

So basically you create a table corresponding to the desired date you have in mind, and pass it to os.time(). It will give you the corresponding timestamp.

Then, still from the documentation, form os.date() this time:

time (optional)

Number. If the time argument is present, this is the time to be formatted (see the os.time() function for a description of this value). Otherwise, date formats the current time.

When called without arguments, date returns a reasonable date and time representation that depends on the host system and on the current locale (that is, os.date() is equivalent to os.date("%c") ).

So basically, once you have the timestamp as described above, pass it to os.date() with the formating options of your choice. You can repeat that in a loop for each month.

From the documentation of os.time() parameter:

table specifying a time to convert to seconds. If table is present, it must have fields year, month, and day, and may have additional fields hour, min, sec, and isdst (for a description of these fields, see the os.date function).

So basically you create a table corresponding to the desired date you have in mind, and pass it to os.time(). It will give you the corresponding timestamp.

Then, still from the documentation, form os.date() this time:

time (optional)

Number. If the time argument is present, this is the time to be formatted (see the os.time() function for a description of this value). Otherwise, date formats the current time.

When called without arguments, date returns a reasonable date and time representation that depends on the host system and on the current locale (that is, os.date() is equivalent to os.date("%c") ).

So basically, once you have the timestamp as described above, pass it to os.date() with the formating options of your choice. You can repeat that in a loop for each month.