can aqDateTime.GetMonth return a 2 character month? Same with GetDay?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2018
03:25 PM
01-17-2018
03:25 PM
can aqDateTime.GetMonth return a 2 character month? Same with GetDay?
I need to get a 2 character month and day from an input string (e.g., 20180109). The aqDateTime.GetMonth strips the leading 0 when the month or day is less than 10.
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2018
03:42 PM
01-17-2018
03:42 PM
You can wrap the result in the string format that you want to use:
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2018
04:27 PM
01-17-2018
04:27 PM
Thank you Marsha_R!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2018
02:07 AM
01-23-2018
02:07 AM
You can use aqConvert.DateTimeToFormatStr with the %m (month) or %d (day) specifiers:
aqConvert.DateTimeToFormatStr(dateTime, "%m")
or aqString.Format as @Marsha_R suggested:
aqString.Format("%02d", aqDateTime.GetMonth(dateTime))
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
