format

Formatting a date string - PHP [duplicate]

雨燕双飞 提交于 2019-12-08 13:35:16
问题 This question already has answers here : Convert one date format into another in PHP (15 answers) Closed 6 years ago . I have a dynamically allocated date from a search engine api results set entered into a multidimensional array, $search_results['Date'] There are two types of Date Data returned, first engine returns, for three result tests: Example 1: 2013-07-22T12:00:03Z Example 2: 2013-07-23T18:18:15Z Example 3: 2013-07-21T23:57:04Z And for the same items, different engine: Example 1:

Insert formatted values as currency type while using EPPlus

此生再无相见时 提交于 2019-12-08 13:18:41
I am using format: type ="$###,###,##0.00" for currency and assigning the format type to the worksheet cells eg. wrkSheet.Cells[0].Style.Numberformat.Format = formatType; But this is inserted as text type in excel. I want this to be inserted as Currency or Number in order to continue to do analysis on the values inserted (sort, sum etc). Currently as it is text type validations do not hold correct. Is there any way to force the type in which the formatted values can be inserted? Your formatting is correct. You needs to covert values to its native types Use this code, it should work: using (var

internal format related to texture2D() in GLSL and glTexImage2D() in OpenGL

女生的网名这么多〃 提交于 2019-12-08 11:03:52
问题 I am confused with the internal format related to texture2D() in GLSL and glTexImage2D() in OpenGL, When I use(pay attention to the third and the eighth parameters): glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA16F_ARB, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, GL_FLOAT, floatDataPtr); I got the nonclampedvalue of sampler2D in the glsl without clamped to [0, 1]: vec4 nonclampedvalue = texture2D(my16floattex2d, texcoord1); When I use: glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 0, GL

git attribute using filter smudge/clean to process .cpp files through shell script not finding filename

ぐ巨炮叔叔 提交于 2019-12-08 09:39:23
问题 I wanted to setup code style formatting for all .cpp files before they are committed to git. I made small script (named codeformat) to do this, (also tried replaing %f with $1) #! /bin/bash clang-format -style=file %f | diff %f -** if [ $? -ne 0 ]; then echo "ERROR: codeformat not correct" exit 1 fi did setup git config and updated .gitattributes with *.cpp filter=codeformat, git config --global filter.codeformat.clean codeformat git config --global filter.codeformat.smudge codeformat looks

Ideas for troubleshooting emacs error: “apply: Spawning child process: exec format error”

做~自己de王妃 提交于 2019-12-08 07:54:36
问题 I'm trying to use rdebug with emacs and cygwin and I'm running into trouble. Whenever I do a M-x rdebug and give it the appropriate script to run, it stops with the error "apply: Spawning child process: exec format error" From some googling, it seems like this could happen if I'm trying to launch a cygwin executable via the windows command prompt or vice versa. It could also happen if the path to the executable is a unix style link. I'm trying to figure out the place where rdebug is being

Initialize and partition disk - how to prevent “you need to format disk” message from appearing?

我们两清 提交于 2019-12-08 07:43:03
问题 I'm trying to initialize, partition and format a disk from application. OS is Windows Server 2008 R2. It doesn't really matter which method do I use for these tasks, but let's assume I'm using DeviceIoControl API. As soon as application initializes and creates a partition Windows would pop a message box saying "You need to format disk... " So, even though my application immediately formats this disk, message box would still be there, and user would be confused, and can actually format it

ASP date format using client culture code-behind

时光怂恿深爱的人放手 提交于 2019-12-08 07:37:53
问题 I have an ASP.NET web application and data in a SQLServer DB. What is the best way to display a date (extracted with LINQ) in the client's culture format, from code-behind. I mean I have users from USA and from Europe, they want different formats: MM/dd/yyyy (US) or dd/MM/yyyy (UK) ? What I would like is something like: from myData in dbContext.myFile Where .../... Select myFile.birthDate.ToString.(**some magic formating here**) Update: Thanks to Darin for quick answer! Tip: if using IE, don

Check date format before parsing

戏子无情 提交于 2019-12-08 07:04:18
问题 I am parsing several documments with the field Duration . But in the differents files, it is in differnt formats, ex: "Duration": "00:43" "Duration": "113.046" "Duration": "21.55 s" I want to parse all of them to the format "Duration": "113.046" , how could I check before any parsing in wich format it is?? Some conditions before this piece of code, because this is not right for all of them: Long duration; DateFormat sdf = new SimpleDateFormat("hh:mm:ss"); try { Date durationD = sdf.parse

Getting millisecond format

我与影子孤独终老i 提交于 2019-12-08 06:52:39
问题 I am trying to get this string to return Minute:Second:Millisecond for my MediaPlayer. I have found this code, but can't figure out how to make the Milliseconds work and put it at 2 decimal places. I'm sure its simple to the right person! private String getTimeString(long millis) { StringBuffer buf = new StringBuffer(); int hours = (int) (millis / (1000*60*60)); int minutes = (int) (( millis % (1000*60*60) ) / (1000*60)); int seconds = (int) (( ( millis % (1000*60*60) ) % (1000*60) ) / 1000);

Format SQL Server 2012 Time(7) to “HH:mm”

依然范特西╮ 提交于 2019-12-08 06:36:13
问题 I have Time(7) columns for each day in the week and I want to format it as HH:mm I tried to use SQL Server 2012 new FORMAT function, but it only shows the NULL value. How can I format a time(7) datatype to display as HH:mm ? 回答1: You should always format your data in the presentation layer. If there are circumstance where the TIME datatype cannot be formatted by your UI, you can cast the value to a DATETIME which will more than likely be supported. SELECT CAST(TimeColumn AS DATETIME) FROM