formatdatetime

VBA Issues converting string to date using format() or CDate()

房东的猫 提交于 2019-12-19 11:52:35
问题 If this has been asked before, please point me in the right direction. I can't seem to find anything useful with my google-ing skills. I have the following code, which reads in a string like this; Outage StartDate: 05/10/11 23:59 EST And pulls out the date information, i.e. 05/10/11 23:59 sStartTime = Mid(objItem.Body, 18, 15) ' Extract the start time Debug.Print "sStartTime after reading: " & sStartTime sStartTime = Format(sStartTime, "dd/mm/yy hh:mm") ' Format date correctly Debug.Print

Conversion with StrToDateTime and TFormatSettings does not work

时光总嘲笑我的痴心妄想 提交于 2019-12-18 03:56:11
问题 This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any

Conversion with StrToDateTime and TFormatSettings does not work

天涯浪子 提交于 2019-12-18 03:56:06
问题 This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any

SQL query that displays “time ago dates” like “one week ago”, “two weeks ago”, “one month ago”, “one year ago”, etc

非 Y 不嫁゛ 提交于 2019-12-06 06:45:34
问题 I need a query that displays dates in the following format: Dates that fall in the past 7 days -> “one week ago” Dates that fall in the past 7 to 14 days -> “two week ago” Etc… Dates that fall in the past 30 days -> “one month ago” Dates that follow in the past 30 to 60 days -> “two months ago Etc.. Dates that fall in the past 365 days -> “one year ago” Dates that fall in the past 365 to 730 days -> “two years ago Etc... If you guys can point me to the right direction I’ll appreciate it.

PHP Zend date format

自作多情 提交于 2019-12-05 16:11:24
问题 I want to input a timestamp in below format to the database. yyyy-mm-dd hh:mm:ss How can I get in above format? When I use $date = new Zend_Date(); it returns month dd, yyyy hh:mm:ss PM I also use a JavaScript calender to insert a selected date and it returns in dd-mm-yyyy format Now, I want to convert these both format into yyyy-mm-dd hh:mm:ss so can be inserted in database. Because date format not matching the database field format the date is not inserted and only filled with * 00-00-00 00

VBA Issues converting string to date using format() or CDate()

不打扰是莪最后的温柔 提交于 2019-12-01 14:42:35
If this has been asked before, please point me in the right direction. I can't seem to find anything useful with my google-ing skills. I have the following code, which reads in a string like this; Outage StartDate: 05/10/11 23:59 EST And pulls out the date information, i.e. 05/10/11 23:59 sStartTime = Mid(objItem.Body, 18, 15) ' Extract the start time Debug.Print "sStartTime after reading: " & sStartTime sStartTime = Format(sStartTime, "dd/mm/yy hh:mm") ' Format date correctly Debug.Print "sStartTime after formatting: " & sStartTime This is what output I usually get: sStartTime after reading:

Conversion with StrToDateTime and TFormatSettings does not work

老子叫甜甜 提交于 2019-11-29 03:19:57
This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any hints? If you want to convert some special DateTime-Formats you should better use VarToDateTime

How to format date in JSTL

做~自己de王妃 提交于 2019-11-28 00:58:46
I have a loop that goes through all the news items we have on our site. One of the fields is date ${newsitem.value['Date']} , given in millliseconds. I'd like to display this date in month/day/year format on the webpage. I thought JSTL format tag, <fmt:formatDate> , would help, but I haven't succeeded. Do you know how to do it? <cms:contentaccess var="newsitem" /> <h2><c:out value="${newsitem.value['Title']}" /></h2> // display date here <c:out value="${newsitem.value['Text']}" escapeXml="false" /> Yes the JSTL formatDate tag should do the job in combination with changing the Timestamp value