Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Manipulation - First Day of current month (Date only)
#1
Greetings,

I use the below code to obtain current date:
Macro NC Arrivals
Code:
Copy      Help
DateTime x
str s
x.FromComputerTime ;;get today's date time
s=x.ToStr(1) ;;convert to string without time part

However, I need the date for the first day date of current month(e.g. "010914").

How do I go about that?

Thanks & Best Regards,
Philip
Best Regards,
Philip
#2
SYSTEMTIME st=x.ToSYSTEMTIME; st.wDay=1; x.FromSYSTEMTIME(st)

or

int days; x.GetParts(0 0 days); x.AddParts(-days+1)
#3
I used the first method and it worked perfectly.
Thanks Gintaras.
Best Regards,
Philip


Forum Jump:


Users browsing this thread: 5 Guest(s)