Mashiane Expert Licensed User Longtime User Oct 4, 2015 #1 Hi I seem to be getting the wrong month name returned from my method, can someone please advise what I might be doing wrong please? Code: Sub NiceDate(sDate As String) As String DateTime.DateFormat = "yyyy-mm-dd" Dim dt As Long = DateTime.DateParse(sDate) DateTime.DateFormat = "MMMM dd, yyyy" Return DateTime.Date(dt) End Sub I'm passing "2015-10-04" (in yyyy-mm-dd format) to it and its returning January 04, 2015.
Hi I seem to be getting the wrong month name returned from my method, can someone please advise what I might be doing wrong please? Code: Sub NiceDate(sDate As String) As String DateTime.DateFormat = "yyyy-mm-dd" Dim dt As Long = DateTime.DateParse(sDate) DateTime.DateFormat = "MMMM dd, yyyy" Return DateTime.Date(dt) End Sub I'm passing "2015-10-04" (in yyyy-mm-dd format) to it and its returning January 04, 2015.
R Roycefer Well-Known Member Licensed User Longtime User Oct 4, 2015 #2 The problem is your first DateTime.DateFormat call. The "m" should be capitalized. Lower case "m"s means "minutes". Try "yyyy-MM-dd". Upvote 0
The problem is your first DateTime.DateFormat call. The "m" should be capitalized. Lower case "m"s means "minutes". Try "yyyy-MM-dd".
Mashiane Expert Licensed User Longtime User Oct 4, 2015 #3 Roycefer said: The problem is your first DateTime.DateFormat call. The "m" should be capitalized. Lower case "m"s means "minutes". Try "yyyy-MM-dd". Click to expand... Thanks a lot, completely missed that one! Upvote 0
Roycefer said: The problem is your first DateTime.DateFormat call. The "m" should be capitalized. Lower case "m"s means "minutes". Try "yyyy-MM-dd". Click to expand... Thanks a lot, completely missed that one!