I am trying to get datetimepicker to return the date in the following format: 08-SEP-2012.
The returned format will be part of a web address and therefore very specific.
It is set on custom formatting, and I can get the day and year right. only the 3 letter month give me a problem. Maybe there is a very simple solution but I can't find it..
I'm fairly new to Visual Basic (or any programming in general) so any assistance would be greatly appreciated.
To convert a date into a string in your required format, use:
Dim s = theDate.ToString("dd-MMM-yyyy").ToUpper()
Related
I'm newbie and I'm making Forms with Developer 6i, but the date format is asking to enter data in dd-mmm-yyyy format.
How can I change it to ddmmyy then I press Enter button so as to make it dd-mm-yyyy.
eg. I entered 120622 then its need to become 12-06-2022.
Hope you will get it.
I tried but gets nothing
Why are you using "6i"? It is 20+ years old and hasn't been supported for over 15 years. If you are trying to learn, doesn't it make sense to learn the new version (12.2.1.4)?
Regardless, if your issue is related to working with a text field/item, simply set the Format Mask for that field to "dd-mm-yyyy". Now when you enter something like 03012023 (Jan 3, 2023) you will see 03-01-2023 when you exit the field.
I am trying to use Mailchimp.com's API 3.0 to add people from a PHP web server, but my datetime values for "timestamp_signup"and "timestamp_opt" are being rejected on insert subscriber.
According to this page :
https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/
the format of timestamp_signup and timestamp_opt is ISO 8601 format and both are writeable.
But all the versions I have tried have been rejected:
"2018-10-19T13:50:37+01:00"
"2018-10-19T13:50:37"
"2018-10-19T13:50"
"2018-10-19"
Many thanks
Ian
What is the correct format?
Great find Ian, that seems to be a new issue within the MailChimp API that occurred first with us around a week ago, but it seems to also not happen always.
I contacted the MailChimp Support and they confirmed it seems to be a problem on their end and that they will look into it.
For now I can confirm that your workaround (YYYY-MM-DD HH:MM:SS) works fine but it is not what the MailChimp API states and should definitely be fixed by them.
The format to use is YYYY-MM-DD HH:MM:SS
Not ISO 8601 which is YYYY-MM-DDTHH:MM:SS+HH:MM
Mailchimp.com's software generated correct ISO8601 dates when it sends datetimes back. However it requires the "T" to be a space, and will reject a date that includes the timezone (the +HH:MM on the end).
This is contrary to my reading of the standard.
#Ian is correct. The right format is not ISO 8601 but the classic one:
YYYY-MM-DD HH:MM:ss
Be careful if you're using JS/NodeJS with momentJS for instance. The right format is the following:
moment().format("YYYY-MM-DD HH:MM:ss")
The seconds are in lower case. Otherwise, you will have the fractional value which results in an error on the Mailchimp side.
I am analyzing a VB system when I stumbled upon the following code snippet. This is my first time reading VB code and this may be a trivial question.
.
.
Format$(txt & "/02/20", "gee")
.
.
My question is, what does "gee" stand for? Is it a date format or something? I cannot find the string anywhere else in the code. If it is a format type, what could it possibly be its equivalent in Java? I found out that Format$ in VB functions similarly to Java String.format().
Here is what the VB documentation says about Format$():
Function Format$(Expression, [Format], [FirstDayOfWeek As VbDayOfWeek
= vbSunday], [FirstWeekOfYear As VbFirstWeekOfYear = vbFirstJan1]) As String
Member of VBA.Strings
Formats an expression
I solved it using Visual Basic's Immediate window. It seems that "gee" is used for conversion from the Western Date to Japanese Imperial years.
Using immediate window:
? Format$( "2012/02/20", "gee")
Output -> H24
Another example:
? Format$("123123123", "#,##0")
Output -> 123,123,123
NOTE:
It seems that the above example using "gee" does not work with PC's having different regional settings. My VB6 is in English but my OS is a Japanese Windows 7 Professional.
The code snippet will always evaluate to "gee". EDIT This turns out not to be the case, see nmenego's answer!
It sounds like someone was experimenting with the Format function, and forgot to delete the experiment from the code!
If you'd like to learn more about Format have a look at the full VB6 documentation on Format and the format specifiers for dates.
Recently,I am handling a solution for WebPart internationalization,but I am not familiar with the culture or habits in different regions.So I am asking for some information if you are glad to help.
Suppose I am a different person in another region,for example,a German.I am using the SharePoint,which is a German edition.So,
1) What's the input habit of me?
For example,if I need to input "10000",will I input "10.000,00" or just "10000"?Which is frequent to the user?
2) How to handle the "Date" and "Time" format?
I think it's better if I can select the date or time instead of inputing the date or time string.
3) Any information that you think will be helpful to me?
That is very kind of you,thanks for your help!
To be honest, I am not sure how you want to handle i18n, but I am assuming that you want to do this on the client side.
In this case, I can recommend using Globalize for formatting (both numerical values and date/time could be handled this way).
As for parsing dates (that is handling dates provided by user), there is actually even easier way - just use jQuery UI Datepicker with valid regional script. Obtaining Date object is as easy as calling Datepicker's getDate method.
I am having a problem with an MVC3 application using a jQuery UI DatePicker object.
Within the MVC application, I ask the user to pick their required culture, i.e en-GB, which then formats all dates and currencies in the application in the british format.
I can then access the formatter code for this via Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern
However, the format returned for UK dates is: dd/MM/yyyy
To format the resulting data from the jQuery UI datepicker, I need to specify a date format. But for UK format dates, I need to specify the format as dd/mm/yy
The simple solution would be to just use Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern in my jQuery calls to format the date, but obviously this gives a formatting inconsistency as this is interpreted differently by jQuery UI (01/December/20112011 instead of 01/12/2011)
Is there any easy way around this?
The only way I can think of doing it is asking the user twice what format to display dates in?
I could think of another solution, but that's pretty low-tech, I'm not sure if that is the right way to do it:
var dateTime = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
var lowerCaseMonths = Regex.Replace(dateTime, "MM","mm");
var yearOnlyOnce = Regex.Replace(lowerCaseMonths, "yyyy", "yy");
Without "explaining variables" just
Regex.Replace(Regex.Replace(Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern, "MM","mm"), "yyyy", "yy")
Then I guess no matter in what format it is, dd/MM/yyyy MM/DD/yyyy dd-MM-yyyy etc, it should work out in jQuery.
Maybe someone has a better solution, but at least this seems better than asking for user input twice.
#System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern.ToLower().Replace("yyyy", "yy")