How to display millisecond from Date and time in vb.net - vb.net

I wish to format my date (22/03/2016 23:59:59) to string with milliseconds.
dr.GetDateTime(1).ToString("yyyy-MM-dd hh:mm:ss")
.ToString("yyyy-MM-dd")
.ToString("hh':'mm':'ss")

If you google DateTime.ToString(), you end up with MSDN documentation explaining this function.
Then you can find a link to Custom Date and Time Format, which explains that to display milliseconds, you must do this :
dr.GetDateTime(1).ToString("yyyy-MM-dd hh:mm:ss fff")

Related

how can i change the date format in asp boiler plate 3.1

Want to change my input type date format dddd, dd-MM-yyyy.
Any update or guidance?
try input tostring("yyyy-MM-dd") but it is default format.
Actually, I am using an asp boilerplate platform. I found that the platform only follows this date format 'yyyy-MM-dd. And this is working.

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '05/20/2020'

I'm making an app with laravel, this features a calendar. I'm using "fullcalendar" which is very restricting on date format and AFAIK only accepts 'yyyy/mm/dd'. I'm using the jQuery datepicker and have edited the formatting to make it work. That all works fine and on the insert for a long time I would never get this error, however suddenly it's started giving me this error after days of not having it. I really don't understand. Unless there's a way to change fullcalendar formatting to match the accepted formatting for SQL, which has not affected my app since now, then I'd love to hear it.
(error: QLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '05/14/2020' for column)
Thanks.
fixed it, my formatter was broken

Selecting a datetime range in YII input form

Here is the problem.
I have to create a submission form on my Yii-based website. The form requires to enter a datetime range.For that I am using "jui datetimepicker" third-party Yii extension.
http://www.yiiframework.com/extension/datetimepicker/
I use two date fields with this extension pertaining to start and end time respectively. So, what I want to achieve is be able to restrict the start datetime only to time in the future (neither past dates nor time should be selected) and the end time itself should be restricted to the maximum of three hours following the start time.
EXAMPLE: a user wants to schedule an event. They choose a date and time, which are of course in the future. Let's say they choose March 15, 13 O'clock as the start time in the start time field. Once they are done and move to the next field ("end time"), the respective datetimepicker restricts the range of time from March 15, 13:00 to March 15, 16:00.
Hence the second datetimepicker should be dynamically updated depending on the input of the first one.
It's possible o specify date range in the datetimepicker starting from the current date, but there is nothing like that for the time selection, so a user still can select time which has already passed.
It's not that I want to solve this problem with this extention, if anybody has any suggestions about YII solutions allowing to specify a datetime range in the most clean and effective way - it would be much appreciated.
You should use the edaterangepicker extension instead.
Given the API for the jquery timepicker addon. you should add the following to your widget call (along side 'model','attribute', etc)
'options'=>array(
'minDateTime'=>'<start dateTime here>',
'onSelect'=>'<JS function to run>'
)
The function you run on the "onSelect" event should dynamically set the minDateTime for the second dateTime input field, for ex:
function (selectedDateTime){
<EndDatePickerElement>.datetimepicker('option', 'minDateTime', <start dateTime here using selectedDateTime> );
}
There are more examples on the link provided earlier if you need to make it even more precise (like say if you wanted the starting date to be pushed back by the amount of time the user was on the page rather than it being set when the page was loaded. etc...)

how to check current system date format?

How can i check the system date format? Tried with the code below, but when i change my system's date format to another date format to test the code, it's still showing the date format before changed!
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern()
Ok. I managed to find the solution, the 'CurrentCulture' has to be 'CurrentUICulture', instead of CurrentCulture. Which is as below:
System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern()

trouble converting UTC date to M/D/YYYY with date.js

I am trying to convert a UTC date that currently looks like <span class="enrolldate">2011-10-01 22:00:00</span>
simply to a M/D/YYYY date format with date.js. Can someone help? Thanks!
From the API for date.js, you can output the format you require with:
Date.today().toString("M/d/yyyy"); // 11/19/2007